stages/prompt: skip password equality check when previous checks failed
This commit is contained in:
parent
a9ee67bf2d
commit
ff64182ae8
|
@ -101,7 +101,7 @@
|
|||
{
|
||||
"identifiers": {
|
||||
"pk": "975d5502-1e22-4d10-b560-fbc5bd70ff4d",
|
||||
"name": "default-password-change-prompt"
|
||||
"name": "Change your password"
|
||||
},
|
||||
"model": "passbook_stages_prompt.promptstage",
|
||||
"attrs": {
|
||||
|
|
|
@ -27,7 +27,7 @@ def create_default_password_change(apps: Apps, schema_editor: BaseDatabaseSchema
|
|||
)
|
||||
|
||||
prompt_stage, _ = PromptStage.objects.using(db_alias).update_or_create(
|
||||
name="default-password-change-prompt",
|
||||
name="Change your password",
|
||||
)
|
||||
password_prompt, _ = Prompt.objects.using(db_alias).update_or_create(
|
||||
field_key="password",
|
||||
|
|
|
@ -113,6 +113,8 @@ class PromptForm(forms.Form):
|
|||
|
||||
def clean(self):
|
||||
cleaned_data = super().clean()
|
||||
if cleaned_data == {}:
|
||||
return {}
|
||||
# Check if we have two password fields, and make sure they are the same
|
||||
password_fields: QuerySet[Prompt] = self.stage.fields.filter(
|
||||
type=FieldTypes.PASSWORD
|
||||
|
@ -127,6 +129,7 @@ class PromptForm(forms.Form):
|
|||
result = engine.result
|
||||
if not result.passing:
|
||||
raise forms.ValidationError(list(result.messages))
|
||||
return cleaned_data
|
||||
|
||||
|
||||
def username_field_cleaner_factory(field: Prompt) -> Callable:
|
||||
|
|
Reference in New Issue