Improved the condition about when to generate ssh keys
This commit is contained in:
parent
2e9d838b64
commit
60d107baee
1 changed files with 1 additions and 4 deletions
|
@ -14,7 +14,6 @@ def generate_ssh_key_name():
|
||||||
|
|
||||||
|
|
||||||
class HostingUserLoginForm(forms.Form):
|
class HostingUserLoginForm(forms.Form):
|
||||||
|
|
||||||
email = forms.CharField(widget=forms.EmailInput())
|
email = forms.CharField(widget=forms.EmailInput())
|
||||||
password = forms.CharField(widget=forms.PasswordInput())
|
password = forms.CharField(widget=forms.PasswordInput())
|
||||||
|
|
||||||
|
@ -45,7 +44,6 @@ class HostingUserLoginForm(forms.Form):
|
||||||
|
|
||||||
|
|
||||||
class HostingUserSignupForm(forms.ModelForm):
|
class HostingUserSignupForm(forms.ModelForm):
|
||||||
|
|
||||||
confirm_password = forms.CharField(widget=forms.PasswordInput())
|
confirm_password = forms.CharField(widget=forms.PasswordInput())
|
||||||
password = forms.CharField(widget=forms.PasswordInput())
|
password = forms.CharField(widget=forms.PasswordInput())
|
||||||
|
|
||||||
|
@ -88,9 +86,8 @@ class UserHostingKeyForm(forms.ModelForm):
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
cleaned_data = self.cleaned_data
|
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()
|
self.cleaned_data['name'] = generate_ssh_key_name()
|
||||||
if not cleaned_data.get('public_key'):
|
|
||||||
private_key, public_key = UserHostingKey.generate_keys()
|
private_key, public_key = UserHostingKey.generate_keys()
|
||||||
cleaned_data.update({
|
cleaned_data.update({
|
||||||
'private_key': private_key,
|
'private_key': private_key,
|
||||||
|
|
Loading…
Reference in a new issue