nexent icon indicating copy to clipboard operation
nexent copied to clipboard

🐛 Bugfix: Reset password strength indicator when re-entering registration modal

Open Dr1985 opened this issue 5 months ago • 0 comments

The passwordValue state was not being cleared when the registration modal re-opened, causing the password strength bar to persist from a previous registration attempt. Added setPasswordValue("") to both resetForm() and the modal-open useEffect.

Fixes #3204

Description

Problem

After registering, logging out, and re-entering the registration page, the password strength indicator bar does not reset to empty. It continues showing the strength level of the previously entered password.

Root Cause

In frontend/components/auth/registerModal.tsx, the password strength indicator is conditionally rendered based on the passwordValue React state:

{passwordValue && (() => { ... })()}

When the registration modal re-opens:

  • form.resetFields() was called, which clears the AntD form fields
  • However, the passwordValue state variable was never reset — it retained the old password value
  • Since passwordValue was still truthy, the old strength indicator persisted

Fix

Added setPasswordValue("") in two places:

  1. resetForm() function (line 76) — ensures password strength clears after successful registration or when switching to login modal
  2. useEffect when modal opens (line 148) — ensures password strength clears when the registration modal re-opens after logout

Files Changed

File Change
frontend/components/auth/registerModal.tsx +2 lines: setPasswordValue("") in resetForm() and in the modal-open useEffect

Testing

  1. Open the registration modal
  2. Type a password (e.g., StrongP@ss1) — observe the strength indicator appears
  3. Register successfully, then logout
  4. Re-open the registration modal
  5. Expected: Password field is empty and password strength indicator is hidden
  6. Before fix: Password strength indicator still showed the old strength level

Dr1985 avatar Jun 09 '26 08:06 Dr1985