flex removed from dash-borad content, reset-password message added to login page

This commit is contained in:
ARvind Tiwari 2017-08-04 00:28:15 +05:30
parent bbdea342cf
commit 75afb59d77
7 changed files with 91 additions and 78 deletions

View file

@ -11,8 +11,6 @@
width: 80%; width: 80%;
margin: 0 auto; margin: 0 auto;
max-width: 1120px; max-width: 1120px;
display: flex;
align-items: center;
} }
.container-table{ .container-table{
margin-top: 35px; margin-top: 35px;

View file

@ -226,9 +226,12 @@ h6 {
/*------Auth section---------*/ /*------Auth section---------*/
.auth-container { .auth-container {
/* height: 100vh; */ min-height: calc(100vh - 120px);
position: relative; position: relative;
flex-grow: 1; /* flex-grow: 1; */
display: flex;
flex-direction: column;
justify-content: center;
} }
.auth-bg { .auth-bg {
@ -423,6 +426,11 @@ h6 {
} }
} }
.auth-box .msg-list {
padding: 15px 25px 5px;
text-align: center;
}
@media (max-width: 540px) { @media (max-width: 540px) {
.auth-container .auth-title h2 { .auth-container .auth-title h2 {
font-size: 32px; font-size: 32px;

View file

@ -17,7 +17,7 @@
<div class="intro-message auth-box sign-up"> <div class="intro-message auth-box sign-up">
<h2 class="section-heading">{% trans "Set your new password"%}</h2> <h2 class="section-heading">{% trans "Set your new password"%}</h2>
{% if messages %} {% if messages %}
<ul class="list-unstyled"> <ul class="list-unstyled msg-list">
{% for message in messages %} {% for message in messages %}
<li>{{ message }}</li> <li>{{ message }}</li>
{% endfor %} {% endfor %}

View file

@ -7,19 +7,22 @@
{% endblock navbar %} {% endblock navbar %}
{% block content %} {% block content %}
<div class="auth-container"> <div class="auth-container">
<div class="auth-bg"></div> <div class="auth-bg"></div>
<div class="auth-center"> <div class="auth-center">
<div class="auth-title"> <div class="auth-title">
<h2>{% trans "Your VM hosted in Switzerland"%}</h2> <h2>{% trans "Your VM hosted in Switzerland"%}</h2>
</div> </div>
<div class="auth-content"> <div class="auth-content">
<div class="intro-message auth-box"> <div class="intro-message auth-box">
<h2 class="section-heading">{% trans "Login"%}</h2> <h2 class="section-heading">{% trans "Login"%}</h2>
{% if messages %}
<ul class="list-unstyled msg-list">
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
<form action="{% url 'hosting:login' %}" method="post" class="form" novalidated> <form action="{% url 'hosting:login' %}" method="post" class="form" novalidated>
{% csrf_token %} {% csrf_token %}
{% for field in form %} {% for field in form %}
@ -31,7 +34,6 @@
{% trans "Login"%} {% trans "Login"%}
</button> </button>
{% endbuttons %} {% endbuttons %}
<input type='hidden' name='next' value='{{request.GET.next}}'/> <input type='hidden' name='next' value='{{request.GET.next}}'/>
</form> </form>
<div class="auth-footer"> <div class="auth-footer">
@ -47,6 +49,5 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -15,7 +15,6 @@
<h2>{% trans "Your VM hosted in Switzerland"%}</h2> <h2>{% trans "Your VM hosted in Switzerland"%}</h2>
</div> </div>
<div class="auth-content"> <div class="auth-content">
<div class="intro-message auth-box sign-up"> <div class="intro-message auth-box sign-up">
<h2 class="section-heading">{% trans "Reset your password"%}</h2> <h2 class="section-heading">{% trans "Reset your password"%}</h2>
<form action="{% url 'hosting:reset_password' %}" method="post" class="form" novalidate> <form action="{% url 'hosting:reset_password' %}" method="post" class="form" novalidate>

View file

@ -36,7 +36,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -193,8 +193,10 @@ class SignupView(CreateView):
name = form.cleaned_data.get('name') name = form.cleaned_data.get('name')
email = form.cleaned_data.get('email') email = form.cleaned_data.get('email')
password = form.cleaned_data.get('password') password = form.cleaned_data.get('password')
this_base_url = "{0}://{1}".format(self.request.scheme, self.request.get_host()) this_base_url = "{0}://{1}".format(self.request.scheme,
CustomUser.register(name, password, email, app='dcl', base_url=this_base_url) self.request.get_host())
CustomUser.register(name, password, email,
app='dcl', base_url=this_base_url)
return HttpResponseRedirect(reverse_lazy('hosting:signup-validate')) return HttpResponseRedirect(reverse_lazy('hosting:signup-validate'))
@ -204,8 +206,10 @@ class SignupValidateView(TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(SignupValidateView, self).get_context_data(**kwargs) context = super(SignupValidateView, self).get_context_data(**kwargs)
login_url = '<a href="' + reverse('hosting:login') + '">' + str(_('login')) + '</a>' login_url = '<a href="' + \
home_url = '<a href="' + reverse('datacenterlight:index') + '">Data Center Light</a>' reverse('hosting:login') + '">' + str(_('login')) + '</a>'
home_url = '<a href="' + \
reverse('datacenterlight:index') + '">Data Center Light</a>'
message = '{signup_success_message} {lurl}</a> \ message = '{signup_success_message} {lurl}</a> \
<br />{go_back} {hurl}.'.format( <br />{go_back} {hurl}.'.format(
signup_success_message=_( signup_success_message=_(
@ -226,15 +230,18 @@ class SignupValidatedView(SignupValidateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(SignupValidateView, self).get_context_data(**kwargs) context = super(SignupValidateView, self).get_context_data(**kwargs)
validated = CustomUser.validate_url(self.kwargs['validate_slug']) validated = CustomUser.validate_url(self.kwargs['validate_slug'])
login_url = '<a href="' + reverse('hosting:login') + '">' + str(_('login')) + '</a>' login_url = '<a href="' + \
reverse('hosting:login') + '">' + str(_('login')) + '</a>'
section_title = _('Account activation') section_title = _('Account activation')
if validated: if validated:
message = '{account_activation_string} <br /> {login_string} {lurl}.'.format( message = '{account_activation_string} <br /> {login_string} {lurl}.'.format(
account_activation_string=_("Your account has been activated."), account_activation_string=_(
"Your account has been activated."),
login_string=_("You can now"), login_string=_("You can now"),
lurl=login_url) lurl=login_url)
else: else:
home_url = '<a href="' + reverse('datacenterlight:index') + '">Data Center Light</a>' home_url = '<a href="' + \
reverse('datacenterlight:index') + '">Data Center Light</a>'
message = '{sorry_message} <br />{go_back_to} {hurl}'.format( message = '{sorry_message} <br />{go_back_to} {hurl}'.format(
sorry_message=_("Sorry. Your request is invalid."), sorry_message=_("Sorry. Your request is invalid."),
go_back_to=_('Go back to'), go_back_to=_('Go back to'),
@ -410,7 +417,8 @@ class SSHKeyCreateView(LoginRequiredMixin, FormView):
public_key = form.cleaned_data.get('public_key', '').decode('utf-8') public_key = form.cleaned_data.get('public_key', '').decode('utf-8')
# Add ssh key to user # Add ssh key to user
try: try:
manager.add_public_key(user=owner, public_key=public_key, merge=True) manager.add_public_key(
user=owner, public_key=public_key, merge=True)
except ConnectionError: except ConnectionError:
pass pass
except WrongNameError: except WrongNameError: