nexent
nexent copied to clipboard
🐛 Bugfix: Reset password strength indicator when re-entering registration modal
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
passwordValuestate variable was never reset — it retained the old password value - Since
passwordValuewas still truthy, the old strength indicator persisted
Fix
Added setPasswordValue("") in two places:
resetForm()function (line 76) — ensures password strength clears after successful registration or when switching to login modaluseEffectwhen 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
- Open the registration modal
- Type a password (e.g.,
StrongP@ss1) — observe the strength indicator appears - Register successfully, then logout
- Re-open the registration modal
- Expected: Password field is empty and password strength indicator is hidden
- Before fix: Password strength indicator still showed the old strength level