diff --git a/hosting/static/hosting/css/commons.css b/hosting/static/hosting/css/commons.css index d20f63b7..f184200b 100644 --- a/hosting/static/hosting/css/commons.css +++ b/hosting/static/hosting/css/commons.css @@ -11,8 +11,6 @@ width: 80%; margin: 0 auto; max-width: 1120px; - display: flex; - align-items: center; } .container-table{ margin-top: 35px; diff --git a/hosting/static/hosting/css/landing-page.css b/hosting/static/hosting/css/landing-page.css index 8b962d76..a5eacd1a 100644 --- a/hosting/static/hosting/css/landing-page.css +++ b/hosting/static/hosting/css/landing-page.css @@ -226,9 +226,12 @@ h6 { /*------Auth section---------*/ .auth-container { - /* height: 100vh; */ + min-height: calc(100vh - 120px); position: relative; - flex-grow: 1; + /* flex-grow: 1; */ + display: flex; + flex-direction: column; + justify-content: center; } .auth-bg { @@ -423,6 +426,11 @@ h6 { } } +.auth-box .msg-list { + padding: 15px 25px 5px; + text-align: center; +} + @media (max-width: 540px) { .auth-container .auth-title h2 { font-size: 32px; diff --git a/hosting/templates/hosting/confirm_reset_password.html b/hosting/templates/hosting/confirm_reset_password.html index 01c64997..d7942455 100644 --- a/hosting/templates/hosting/confirm_reset_password.html +++ b/hosting/templates/hosting/confirm_reset_password.html @@ -17,7 +17,7 @@ <div class="intro-message auth-box sign-up"> <h2 class="section-heading">{% trans "Set your new password"%}</h2> {% if messages %} - <ul class="list-unstyled"> + <ul class="list-unstyled msg-list"> {% for message in messages %} <li>{{ message }}</li> {% endfor %} diff --git a/hosting/templates/hosting/login.html b/hosting/templates/hosting/login.html index 12c9eba6..9f18fda9 100644 --- a/hosting/templates/hosting/login.html +++ b/hosting/templates/hosting/login.html @@ -7,46 +7,47 @@ {% endblock navbar %} {% block content %} - <div class="auth-container"> <div class="auth-bg"></div> - - <div class="auth-center"> - - <div class="auth-title"> - <h2>{% trans "Your VM hosted in Switzerland"%}</h2> - </div> - <div class="auth-content"> - - <div class="intro-message auth-box"> - <h2 class="section-heading">{% trans "Login"%}</h2> - <form action="{% url 'hosting:login' %}" method="post" class="form" novalidated> - {% csrf_token %} - {% for field in form %} - {% bootstrap_field field show_label=False type='fields'%} - {% endfor %} - <p class="red">{{form.non_field_errors|striptags}}</p> - {% buttons %} - <button type="submit" class="btn btn-block btn-success"> - {% trans "Login"%} - </button> - {% endbuttons %} - - <input type='hidden' name='next' value='{{request.GET.next}}'/> - </form> - <div class="auth-footer"> - <div class="text"> - <span>{% trans "Don't have an account yet ? "%}</span> - </div> - <div class="links"> - <a class="unlink" href="{% url 'hosting:signup' %}">{% trans "Sign up"%}</a> - <span class="text"> or </span> - <a class="unlink" href="{% url 'hosting:reset_password' %}">{% trans "Forgot your password ? "%}</a> - </div> + <div class="auth-center"> + <div class="auth-title"> + <h2>{% trans "Your VM hosted in Switzerland"%}</h2> + </div> + <div class="auth-content"> + <div class="intro-message auth-box"> + <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> + {% csrf_token %} + {% for field in form %} + {% bootstrap_field field show_label=False type='fields'%} + {% endfor %} + <p class="red">{{form.non_field_errors|striptags}}</p> + {% buttons %} + <button type="submit" class="btn btn-block btn-success"> + {% trans "Login"%} + </button> + {% endbuttons %} + <input type='hidden' name='next' value='{{request.GET.next}}'/> + </form> + <div class="auth-footer"> + <div class="text"> + <span>{% trans "Don't have an account yet ? "%}</span> + </div> + <div class="links"> + <a class="unlink" href="{% url 'hosting:signup' %}">{% trans "Sign up"%}</a> + <span class="text"> or </span> + <a class="unlink" href="{% url 'hosting:reset_password' %}">{% trans "Forgot your password ? "%}</a> </div> </div> </div> </div> - + </div> </div> {% endblock %} diff --git a/hosting/templates/hosting/reset_password.html b/hosting/templates/hosting/reset_password.html index b24546c5..3bdd1437 100644 --- a/hosting/templates/hosting/reset_password.html +++ b/hosting/templates/hosting/reset_password.html @@ -15,7 +15,6 @@ <h2>{% trans "Your VM hosted in Switzerland"%}</h2> </div> <div class="auth-content"> - <div class="intro-message auth-box sign-up"> <h2 class="section-heading">{% trans "Reset your password"%}</h2> <form action="{% url 'hosting:reset_password' %}" method="post" class="form" novalidate> diff --git a/hosting/templates/hosting/signup.html b/hosting/templates/hosting/signup.html index 5d97a3b6..52179a42 100644 --- a/hosting/templates/hosting/signup.html +++ b/hosting/templates/hosting/signup.html @@ -8,35 +8,34 @@ {% block content %} <div class="auth-container auth-signup"> <div class="auth-bg"></div> - <div class="auth-center "> - <div class="auth-title"> - <h2>{% trans "Your VM hosted in Switzerland"%}</h2> - </div> - <div class="auth-content"> - <div class="intro-message auth-box sign-up"> - <h2 class="section-heading">{% trans "Sign up"%}</h2> - <form action="{% url 'hosting:signup' %}" method="post" class="form" novalidate> - {% csrf_token %} - {% for field in form %} - {% bootstrap_field field show_label=False %} - {% endfor %} - {% buttons %} - <button type="submit" class="btn btn-block btn-info"> - {% trans "Sign up"%} - </button> - {% endbuttons %} - </form> - <div class="auth-footer"> - <div class="text"> - <span>{% trans "Already have an account ?"%}</span> - </div> - <div class="links"> - <a class="unlink" href="{% url 'hosting:login' %}">{% trans "Login"%}</a> - </div> + <div class="auth-center "> + <div class="auth-title"> + <h2>{% trans "Your VM hosted in Switzerland"%}</h2> + </div> + <div class="auth-content"> + <div class="intro-message auth-box sign-up"> + <h2 class="section-heading">{% trans "Sign up"%}</h2> + <form action="{% url 'hosting:signup' %}" method="post" class="form" novalidate> + {% csrf_token %} + {% for field in form %} + {% bootstrap_field field show_label=False %} + {% endfor %} + {% buttons %} + <button type="submit" class="btn btn-block btn-info"> + {% trans "Sign up"%} + </button> + {% endbuttons %} + </form> + <div class="auth-footer"> + <div class="text"> + <span>{% trans "Already have an account ?"%}</span> + </div> + <div class="links"> + <a class="unlink" href="{% url 'hosting:login' %}">{% trans "Login"%}</a> </div> </div> - </div> - - </div> + </div> + </div> + </div> </div> {% endblock %} diff --git a/hosting/views.py b/hosting/views.py index 520894ae..279e0930 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -193,8 +193,10 @@ class SignupView(CreateView): name = form.cleaned_data.get('name') email = form.cleaned_data.get('email') password = form.cleaned_data.get('password') - this_base_url = "{0}://{1}".format(self.request.scheme, self.request.get_host()) - CustomUser.register(name, password, email, app='dcl', base_url=this_base_url) + this_base_url = "{0}://{1}".format(self.request.scheme, + self.request.get_host()) + CustomUser.register(name, password, email, + app='dcl', base_url=this_base_url) return HttpResponseRedirect(reverse_lazy('hosting:signup-validate')) @@ -204,8 +206,10 @@ class SignupValidateView(TemplateView): def get_context_data(self, **kwargs): context = super(SignupValidateView, self).get_context_data(**kwargs) - login_url = '<a href="' + reverse('hosting:login') + '">' + str(_('login')) + '</a>' - home_url = '<a href="' + reverse('datacenterlight:index') + '">Data Center Light</a>' + login_url = '<a href="' + \ + reverse('hosting:login') + '">' + str(_('login')) + '</a>' + home_url = '<a href="' + \ + reverse('datacenterlight:index') + '">Data Center Light</a>' message = '{signup_success_message} {lurl}</a> \ <br />{go_back} {hurl}.'.format( signup_success_message=_( @@ -226,15 +230,18 @@ class SignupValidatedView(SignupValidateView): def get_context_data(self, **kwargs): context = super(SignupValidateView, self).get_context_data(**kwargs) 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') if validated: 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"), lurl=login_url) 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( sorry_message=_("Sorry. Your request is invalid."), 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') # Add ssh key to user 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: pass except WrongNameError: @@ -563,7 +571,7 @@ class PaymentVMView(LoginRequiredMixin, FormView): # Create a Hosting Bill HostingBill.create( - customer=customer, billing_address=billing_address) + customer=customer, billing_address=billing_address) # Create Billing Address for User if he does not have one if not customer.user.billing_addresses.count():