Skip to content

Comments

nsc-events-fullstack_31_143_password-reuse-validation#147

Open
jmathew12 wants to merge 5 commits intomainfrom
143-missing-password-reuse-validation
Open

nsc-events-fullstack_31_143_password-reuse-validation#147
jmathew12 wants to merge 5 commits intomainfrom
143-missing-password-reuse-validation

Conversation

@jmathew12
Copy link
Contributor

@jmathew12 jmathew12 commented Feb 1, 2026

Summary & Changes 📃

  • Resolves: Missing Password Reuse Validation #143

  • Summary: (Briefly describe what this PR does)

    • 🔨 What does this issue fix?
    • Currently, the password reset workflow allows users to reset their credentials to the same password they are already using.

This behavior results to:

redundant password hashing & higher compute usage,
unnecessary write operations & increased database transaction volume.
Repeated no-op(no operation) password updates create unnecessary load on the database, increasing compute, storage, and replication costs in managed services like AWS. At scale, this behavior inflates infrastructure costs without improving security or user experience.

To prevent this, enforce a validation during password resets to block the reuse of current or previously used passwords.

  • 👀 What is the expected behavior?

  • Validation checks will run accordingly and dialog will display Cannot use the same password when trying to reset with duplicate password.

  • 🗨️ Any relevant technical details?

  • Changes:

    • ✅ List key changes made
    • 🛠️ Mention breaking changes (if any)
    • 🔗 Link relevant discussions/issues
    • 📝 Additional info to assist developers & reviewers
      Added password checks to see if the new password is the same as the current, if yes, display error and do nothing to db
      A new task can be that keep a history of all the previous passwords and not allow users to use any of the old passwords

Screenshots / Visual Aids 🔎

📌 Required for: UI changes, layout updates, or bug fixes.

Expand ⬇️ [Screencast from 2026-01-31 23-50-11.webm](https://github.com/user-attachments/assets/70162c95-9310-446e-8f21-b2bd31121486)

How to Test 🧪

  1. Steps to Reproduce:
    • Step 1: Start the front end and back end
    • Step 2: login
    • Step 3: go to profile
    • Step 4: click change password
    • Step 5: enter current password for all three fields
    • Step 6: click change password
  2. Expected Behavior: (Describe what should happen)
    Should see a message on the screen saying new password should be different than the current passoword
  3. Actual Behavior (if bug): (Describe what happens instead)

Checklist ✅

  • I have tested this PR locally and it works as expected.
  • This PR resolves an issue (Missing Password Reuse Validation #143).
  • Reviewers, assignees(self), tags, and labels are correctly assigned.
  • Squash commits and enable auto-merge if approved.

@jmathew12 jmathew12 self-assigned this Feb 1, 2026
@jmathew12 jmathew12 linked an issue Feb 1, 2026 that may be closed by this pull request
@jmathew12 jmathew12 marked this pull request as draft February 1, 2026 07:03
@jmathew12 jmathew12 requested review from a team, Bejarano03, BradleyCharles, IsaacJrTypes, JesseCaddell, NSCADprogram, ParysUnangst, bcko and taylorpapke and removed request for a team February 1, 2026 07:55
@jmathew12 jmathew12 marked this pull request as ready for review February 1, 2026 07:56
@jmathew12 jmathew12 marked this pull request as draft February 1, 2026 07:57
@jmathew12 jmathew12 marked this pull request as ready for review February 1, 2026 08:01
@jmathew12 jmathew12 marked this pull request as draft February 2, 2026 05:37
Copy link
Contributor

@TVW96 TVW96 left a comment

Choose a reason for hiding this comment

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

I tested and the duplicate password was successfully declined. Good work!

You can move this out of draft and into review.

test_reuse_password.mov

@jmathew12 jmathew12 marked this pull request as ready for review February 5, 2026 08:46
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

E2E Test Results

  • Total: 100
  • Passed: 100
  • Failed: 0

View detailed report

@NahomAlemu NahomAlemu requested review from NahomAlemu and removed request for Bejarano03 and ParysUnangst February 19, 2026 20:17
Copy link
Contributor

@NahomAlemu NahomAlemu left a comment

Choose a reason for hiding this comment

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

I confirm that this PR adds password reuse validation to prevent users from setting their new password to their current password. The backend now checks if the new password matches the current one in both resetPassword and changePassword flows, throwing a BadRequestException with a clear message. The tests were updated accordingly, though there are some commented-out lines that should be removed for cleaner code.

password_pr.mov

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.

Missing Password Reuse Validation

3 participants