Skip to content

Fix inline validation errors on password update form#5315

Open
ajrbyers wants to merge 1 commit into
masterfrom
b-4642-password-update-errors
Open

Fix inline validation errors on password update form#5315
ajrbyers wants to merge 1 commit into
masterfrom
b-4642-password-update-errors

Conversation

@ajrbyers
Copy link
Copy Markdown
Member

Closes #4642

Wrap edit-profile password change in PasswordChangeForm so validation errors (current-password mismatch, confirmation mismatch, policy failures) render inline via the form errors partial and the page stays put on failure instead of redirecting with disappearing toasts. Adds the password_rules partial so requirements are visible upfront.
Copy link
Copy Markdown
Member

@mauromsl mauromsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one minor tidbit

Comment thread src/core/forms/forms.py
new_two = cleaned.get("new_password_two")

if new_one and new_two and new_one != new_two:
self.add_error("new_password_two", _("Passwords do not match."))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All we've done here is change the punctuation, it is worth updating the key on PO files

Comment thread src/core/forms/forms.py
Comment on lines +291 to +296
if new_one and self.user and self.request:
problems = self.user.password_policy_check(self.request, new_one)
for problem in problems:
self.add_error("new_password_one", _("Password not updated: ") + str(problem))

return cleaned
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are adding the errors on the form inline, which is great, but we lost the messages / toastr prompt. Is it worth also displaying one?

@mauromsl mauromsl assigned ajrbyers and unassigned mauromsl May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Password update: Users need informative and persistent messaging if password update fails due to not meeting requirements

2 participants