Skip to content
Snippets Groups Projects
Verified Commit 893c2d6f authored by Frank Sauerburger's avatar Frank Sauerburger
Browse files

Enforce password repetition

parent ad977be6
No related branches found
Tags 0.2.0-rc
1 merge request!11Resolve "Repeate password during CA creation"
Pipeline #7624 waiting for manual action
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment