Skip to content
Snippets Groups Projects

Resolve "Repeate password during CA creation"

Merged Frank Sauerburger requested to merge 23-repeate-password-during-ca-creation into master
1 file
+ 17
0
Compare changes
  • Side-by-side
  • Inline
+ 17
0
@@ -15,6 +15,11 @@ class CaCreateForm(forms.Form):
widget=forms.PasswordInput(),
required=True,
)
repeat = forms.CharField(
max_length=128,
widget=forms.PasswordInput(),
required=True,
)
length = forms.TypedChoiceField(
choices=length_choices,
coerce=int,
@@ -43,6 +48,18 @@ class CaCreateForm(forms.Form):
public = forms.BooleanField(required=False)
def clean(self):
"""Custom validation to match passwords"""
cleaned_data = super().clean()
password = cleaned_data.get('password')
repeat = cleaned_data.get('repeat')
if password and repeat:
if password != repeat:
raise forms.ValidationError("The two password fields must match")
return cleaned_data
class CsrCreateForm(forms.Form):
csr_pem = forms.FileField()
Loading