From 60d107baeeba504a4e7a621847f1d62478c0562b Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Thu, 3 Aug 2017 15:07:36 +0200 Subject: [PATCH] Improved the condition about when to generate ssh keys --- hosting/forms.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hosting/forms.py b/hosting/forms.py index c2b86e3e..d9812995 100644 --- a/hosting/forms.py +++ b/hosting/forms.py @@ -14,7 +14,6 @@ def generate_ssh_key_name(): class HostingUserLoginForm(forms.Form): - email = forms.CharField(widget=forms.EmailInput()) password = forms.CharField(widget=forms.PasswordInput()) @@ -45,7 +44,6 @@ class HostingUserLoginForm(forms.Form): class HostingUserSignupForm(forms.ModelForm): - confirm_password = forms.CharField(widget=forms.PasswordInput()) password = forms.CharField(widget=forms.PasswordInput()) @@ -88,9 +86,8 @@ class UserHostingKeyForm(forms.ModelForm): def clean(self): cleaned_data = self.cleaned_data - if not self.cleaned_data.get('name', ''): + if 'generate' in self.request.POST: self.cleaned_data['name'] = generate_ssh_key_name() - if not cleaned_data.get('public_key'): private_key, public_key = UserHostingKey.generate_keys() cleaned_data.update({ 'private_key': private_key,