Skip to content

feat: implement password requirements on web (M2-10507)#719

Open
sricharan-varanasi wants to merge 35 commits intodevfrom
feature/password-requirements-web
Open

feat: implement password requirements on web (M2-10507)#719
sricharan-varanasi wants to merge 35 commits intodevfrom
feature/password-requirements-web

Conversation

@sricharan-varanasi
Copy link
Copy Markdown
Contributor

  • Tests for the changes have been added
  • Related documentation has been added / updated
  • OSS packages added to Curious open source credit page

📝 Description

🔗 Jira Ticket M2-10507

Changes include:

  • Unicode-aware password validation utility (checkPassword) with NFC normalization - emoji counts as 1 char, caseless scripts (CJK, Arabic, Hebrew, etc.) count as both upper and lowercase
  • Password rules enforced: min 10 chars, no spaces, at least 3 of 4 character types (uppercase, lowercase, digit, symbol)
  • PasswordRequirementsTooltip component - real-time ✓/✗ checklist shown next to password fields on Signup, Recovery, and Change Password forms
  • Zod schemas converted to factory functions calling i18n.t() with interpolation params (matching admin pattern) - error messages now show correct min length per context (10 for new passwords, 6 for legacy/login)
  • i18n keys added across all 5 languages (en, fr, es, pt, el)
  • 56 unit tests for checkPassword

🪤 Peer Testing

  • Sign up: Enter passwords and verify the tooltip appears next to the password field showing requirements updating in real-time. Try passwords shorter than 10 chars, with spaces, with fewer than 3 character types - each should show as ✗. A valid password (e.g. MyPassword1!) should show all ✓.

  • Login: Enter a password shorter than 6 characters - should show min length error with "6" in the message.

  • Change Password / Recovery Password: Same tooltip behavior as signup. Old password field accepts min 6 chars (legacy). New password enforces the full 10-char + complexity rules.

  • Language switching: Switch to fr/es/pt/el and verify error messages and tooltip text are translated with correct interpolated numbers.

✏️ Notes

Mirrors the admin PR implementation. Schemas are now factory functions (not module-level constants) so they can call i18n.t() with { chars } and { types } params at creation time.

@sricharan-varanasi sricharan-varanasi changed the title Feature/password requirements web feat: implement password requirements on web (M2-10507) Apr 9, 2026
@aws-amplify-us-east-1
Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-719.dek0ppt2nc92n.amplifyapp.com

@sricharan-varanasi sricharan-varanasi force-pushed the feature/password-requirements-web branch from c2df86e to 3e96322 Compare April 9, 2026 21:54
Comment thread src/i18n/pt/translation.json
Comment thread src/features/Login/model/login.schema.ts Outdated
Comment thread src/features/ChangePassword/model/schema.ts Outdated
Copy link
Copy Markdown

@adeiji adeiji left a comment

Choose a reason for hiding this comment

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

Everything looks great. Nice work! I just noted one potential issue with translations and maybe needing to use useTranslation().

@divbzero divbzero self-requested a review April 10, 2026 18:48
Copy link
Copy Markdown
Contributor

@divbzero divbzero left a comment

Choose a reason for hiding this comment

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

@sricharan-varanasi Looks good! Please take a look at the comments marked [Important] before merging. The other comments are minor so feel free to use your judgment on whether to make those changes.

Comment thread src/shared/utils/passwordValidation.ts
Comment thread src/features/ChangePassword/model/schema.ts Outdated
Comment thread src/features/RecoveryPassword/model/schema.ts Outdated
Comment thread src/features/Signup/model/signup.schema.ts Outdated
Comment thread src/features/ChangePassword/model/schema.ts Outdated
Comment thread src/features/RecoveryPassword/model/schema.ts Outdated
Comment thread src/features/Signup/model/signup.schema.ts Outdated
Comment thread src/features/Login/model/login.schema.ts Outdated
divbzero added a commit to ChildMindInstitute/mindlogger-backend-refactor that referenced this pull request Apr 12, 2026
Validate caseless characters in passwords as both uppercase and
lowercase. This matches the behavior on the frontend:

- ChildMindInstitute/mindlogger-admin#2207
- ChildMindInstitute/mindlogger-app-refactor#1089
- ChildMindInstitute/mindlogger-web-refactor#719
divbzero added a commit to ChildMindInstitute/mindlogger-backend-refactor that referenced this pull request Apr 13, 2026
…2038)

🔗 [Jira Ticket M2-10505](https://mindlogger.atlassian.net/browse/M2-10505)

Changes include:

- Validate caseless characters in passwords as both uppercase and lowercase.

This is a follow-up to pull request #2036. After thinking through @jodybrookover’s comments, seems to make sense to allow caseless characters in passwords to validate as both uppercase and lowercase letters. There tend to be more caseless characters than uppercase or lowercase letters, and this matches the behavior already implemented on the frontend with:

- ChildMindInstitute/mindlogger-admin#2207
- ChildMindInstitute/mindlogger-app-refactor#1089
- ChildMindInstitute/mindlogger-web-refactor#719
Copy link
Copy Markdown
Contributor

@divbzero divbzero left a comment

Choose a reason for hiding this comment

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

@adeiji Your added changes look good! Just one [Important] comment to double check, the others are minor.

Comment thread src/i18n/pt/translation.json Outdated
"passwordBlankSpaces": "A senha não deve conter espaços.",
"passwordCharacterTypes": "A senha deve conter pelo menos {{types}} de: maiúsculas, minúsculas, números, símbolos.",
"passwordMustInclude": "A senha deve incluir:",
"passwordMustInclude": "A palavra-chave deve conter no mínimo 10 caracteres, sem espaços, e pelo menos 3 dos 4 itens abaixo:",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Important] Add passwordMustIncludeMinimum?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(Minor) Parametrize the numbers in these translations?

Comment thread src/features/Signup/ui/SignupForm.tsx Outdated
const passwordValue = useWatch({ control: form.control, name: 'password' });

useEffect(() => {
clearErrors('password');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did we intentionally remove clearErrors here? I think we still clearErrors on the other forms.

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.

4 participants