Skip to content

fix: ask for current password in password reset flow - #4116

Open
gtmdev-br wants to merge 1 commit into
conversejs:masterfrom
gtmdev-br:fix/password-reset-current-password
Open

fix: ask for current password in password reset flow#4116
gtmdev-br wants to merge 1 commit into
conversejs:masterfrom
gtmdev-br:fix/password-reset-current-password

Conversation

@gtmdev-br

Copy link
Copy Markdown

Summary

This PR adds a current password field to the password reset form, as requested in #3120. The change ensures that users must provide their current password before being allowed to reset it, preventing unauthorized password changes by someone with access to the browser.

Changes

  1. Template (src/plugins/profile/templates/password-reset.js):

    • Added a new "Current password" input field with proper autocomplete="current-password" attribute
  2. Component (src/plugins/profile/password-reset.js):

    • Added current_password_error state property
    • Added validation to ensure current password is provided
    • Handle not-authorized error from XMPP server when current password is incorrect
  3. Tests (src/plugins/profile/tests/password-reset.js):

    • Updated submitPasswordResetForm helper to include current password
    • Added new test case for incorrect current password scenario

Testing

All 4 password reset tests pass:

  • allows you to reset your password
  • informs you if you cannot reset your password due to registration not being supported
  • informs you if you're not allowed to reset your password
  • informs you if the current password is incorrect (NEW)

Closes #3120

- Add current password field to the password reset form
- Validate current password is provided before allowing reset
- Handle 'not-authorized' error from server when current password is incorrect
- Add test for incorrect current password scenario

Closes conversejs#3120

const jid = _converse.session.get('jid');
const domain = _converse.session.get('domain');
const connection = api.connection.get();
const jid = _converse.session.get('jid');
const domain = _converse.session.get('domain');
const connection = api.connection.get();
const bare_jid = Strophe.getBareJidFromJid(jid);
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.

Ask user to provide current password in order to reset password

2 participants