From 4216d9911a4975bd38731b33c431a5c66b9c7877 Mon Sep 17 00:00:00 2001 From: ARvind Tiwari Date: Wed, 26 Jul 2017 16:45:49 +0530 Subject: [PATCH] add ssh key form input shadows removed --- hosting/static/hosting/css/user_keys.css | 20 +++++++------- hosting/templates/hosting/user_keys.html | 2 +- hosting/views.py | 34 +++++++++++++++--------- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/hosting/static/hosting/css/user_keys.css b/hosting/static/hosting/css/user_keys.css index 4f8a27b7..427ea960 100644 --- a/hosting/static/hosting/css/user_keys.css +++ b/hosting/static/hosting/css/user_keys.css @@ -171,11 +171,10 @@ h2,h3,h4,h5{ border-radius: 0; font-family: 'Lato-Light', sans-serif; font-size: 20px; + padding-left: 0; } .form_key_name::-webkit-input-placeholder{ - position: relative; - left:-10px; font-size: 20px; font-weight:100; font-family: 'Lato-Light', sans-serif; @@ -183,21 +182,18 @@ h2,h3,h4,h5{ } .form_key_name::-moz-input-placeholder{ - left:-10px; font-size: 20px; font-weight:200; font-family: 'Lato-Light', sans-serif; } .form_key_name:-moz-input-placeholder{ - left:-10px; font-family: 'Lato-Light', sans-serif; font-size: 20px; font-weight:200; } .form_key_name:-ms-input-placeholder { - left:-10px; font-size: 20px; font-family: 'Lato-Light', sans-serif; font-weight:200; @@ -206,7 +202,6 @@ h2,h3,h4,h5{ .form_public_key::-webkit-input-placeholder{ position: relative; top: 80%; - left:-10px; font-size: 20px; font-weight:200; font-family: 'Lato-Light', sans-serif; @@ -215,7 +210,6 @@ h2,h3,h4,h5{ .form_public_key::-moz-input-placeholder{ position: relative; top: 80%; - left:-10px; font-size: 20px; font-family: 'Lato-Light', sans-serif; font-weight:200; @@ -224,7 +218,6 @@ h2,h3,h4,h5{ .form_public_key:-moz-input-placeholder{ position: relative; top: 80%; - left:-10px; font-size: 20px; font-weight:200; font-family: 'Lato-Light', sans-serif; @@ -232,7 +225,6 @@ h2,h3,h4,h5{ .form_public_key:-ms-input-placeholder { position: relative; top: 80%; - left:-10px; font-size: 20px; font-weight:200; font-family: 'Lato-Light', sans-serif; @@ -263,3 +255,13 @@ h2,h3,h4,h5{ .custom_form_button{ border-radius: 0; } + + +.form_key_name:focus, +.form_public_key:focus, +.has-error .form_key_name, +.has-error .form_public_key, +.has-error .form_key_name:focus, +.has-error .form_public_key:focus { + box-shadow: none; +} \ No newline at end of file diff --git a/hosting/templates/hosting/user_keys.html b/hosting/templates/hosting/user_keys.html index ea2bbacf..a871ae86 100644 --- a/hosting/templates/hosting/user_keys.html +++ b/hosting/templates/hosting/user_keys.html @@ -17,7 +17,7 @@

- {% trans "Add Key"%} +   {% trans "Add Key"%}

To generate a new key pair or to upload your existing key, click "Add Key"
diff --git a/hosting/views.py b/hosting/views.py index b4b5853c..d8fca05e 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -197,8 +197,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')) @@ -208,8 +210,10 @@ class SignupValidateView(TemplateView): def get_context_data(self, **kwargs): context = super(SignupValidateView, self).get_context_data(**kwargs) - login_url = '' + str(_('login')) + '' - home_url = 'Data Center Light' + login_url = '' + str(_('login')) + '' + home_url = 'Data Center Light' message = '{signup_success_message} {lurl} \
{go_back} {hurl}.'.format( signup_success_message=_( @@ -230,15 +234,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 = '' + str(_('login')) + '' + login_url = '' + str(_('login')) + '' section_title = _('Account activation') if validated: message = '{account_activation_string}
{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 = 'Data Center Light' + home_url = 'Data Center Light' message = '{sorry_message}
{go_back_to} {hurl}'.format( sorry_message=_("Sorry. Your request is invalid."), go_back_to=_('Go back to'), @@ -384,7 +391,8 @@ class SSHKeyChoiceView(LoginRequiredMixin, View): name = generate_ssh_key_name() private_key, public_key = UserHostingKey.generate_keys() content = ContentFile(private_key) - ssh_key = UserHostingKey.objects.create(user=request.user, public_key=public_key, name=name) + ssh_key = UserHostingKey.objects.create( + user=request.user, public_key=public_key, name=name) filename = name + '_' + str(uuid.uuid4())[:8] + '_private.pem' ssh_key.private_key.save(filename, content) return redirect(reverse_lazy('hosting:ssh_keys'), foo='bar') @@ -407,7 +415,8 @@ class SSHKeyCreateView(LoginRequiredMixin, FormView): form.save() if 'dcl-generated-key-' in form.instance.name: content = ContentFile(form.cleaned_data.get('private_key')) - filename = form.cleaned_data.get('name') + '_' + str(uuid.uuid4())[:8] + '_private.pem' + filename = form.cleaned_data.get( + 'name') + '_' + str(uuid.uuid4())[:8] + '_private.pem' form.instance.private_key.save(filename, content) context = self.get_context_data() @@ -433,10 +442,11 @@ class SSHKeyCreateView(LoginRequiredMixin, FormView): manager = OpenNebulaManager() # Get user ssh key - public_key = form.cleaned_data.get('public_key', '').decode('utf-8') + public_key = form.cleaned_data.get('public_key', '') # 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: @@ -591,7 +601,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():