fix: Password requirement are not clear on the email signup page#3771
fix: Password requirement are not clear on the email signup page#3771cursor[bot] wants to merge 1 commit intomainfrom
Conversation
Add password hint text and client-side validation to the signup form in Login.tsx, matching the existing pattern from OwnerSetup.tsx. - Display '8+ characters, at least 1 number and 1 capital letter' hint below the password field - Validate password meets requirements on submit - Show per-field error messages for password and confirm password - Follows the same isPasswordValid logic and error styling used in the owner setup page Closes #1647
|
👋 Commands for maintainers:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| } | ||
|
|
||
| setSignupFieldErrors(fieldErrors); | ||
| if (Object.keys(fieldErrors).length > 0) { |
There was a problem hiding this comment.
Stale field errors persist after early return
Medium Severity
handleSignupSubmit clears formError at the top (line 372) but never clears signupFieldErrors. The call to setSignupFieldErrors(fieldErrors) only happens at line 399, which is after the early returns for missing name (line 383) and missing email/password (line 388). If a user first triggers a password field error, then triggers one of those early returns on the next submit, the stale red password error text remains visible alongside the new formError banner.
| if (!/[0-9]/.test(password)) return false; | ||
| if (!/[A-Z]/.test(password)) return false; | ||
| return true; | ||
| }; |
There was a problem hiding this comment.
Duplicated isPasswordValid function across two files
Low Severity
isPasswordValid is duplicated verbatim in both Login.tsx and OwnerSetup.tsx. If password requirements change, both copies need to be updated in lockstep, which is error-prone. This is a good candidate for extraction into a shared utility.
| const [signupEmail, setSignupEmail] = useState(""); | ||
| const [signupPassword, setSignupPassword] = useState(""); | ||
| const [signupConfirmPassword, setSignupConfirmPassword] = useState(""); | ||
| const [signupFieldErrors, setSignupFieldErrors] = useState<Record<string, string>>({}); |
There was a problem hiding this comment.
Field errors not cleared when toggling modes
Low Severity
The newly introduced signupFieldErrors state is not cleared in handleToggleMode (which clears formError but not signupFieldErrors). If a user triggers password field errors, switches to login mode, and then switches back to signup mode, the stale red error text remains visible on the password field instead of reverting to the hint.


Summary
Adds password requirement hints and client-side validation to the email signup form on the login page, matching the existing pattern from the Owner Setup page (
OwnerSetup.tsx).Changes
isPasswordValid()function (same logic asOwnerSetup.tsx) to validate password on form submitOwnerSetup.tsxBefore / After
Before: No password requirements shown on the signup form — users only discover requirements after a failed submit.
After: Password requirements are visible as a hint below the password field. If validation fails on submit, field-level error messages replace the hint.
Closes #1647