Skip to content

fix(auth): drop password length rule from sign-in form - #169

Open
devs-rootstrap wants to merge 1 commit into
masterfrom
fix/sign-in-password-validation
Open

devs-rootstrap wants to merge 1 commit into
masterfrom
fix/sign-in-password-validation

Conversation

@devs-rootstrap

Copy link
Copy Markdown
Collaborator

Jira board reference:


What does this do?

Removes the minimum password length rule from the sign-in form (src/components/login-form.tsx). The sign-in form now only checks that a password was entered:

  • Dropped the MIN_CHARS constant and the .min(MIN_CHARS, ...passwordMinChars) rule.
  • The password field now uses .min(1, translate('auth.signIn.validation.passwordRequired')), so an empty string shows the same "Password is required" error as a missing value.
  • Removed the auth.signIn.validation.passwordMinChars key from src/translations/en.json. Nothing else used it, and en.json is the only translation file.
  • Updated the login form example in docs/src/content/docs/ui-and-theme/Forms.mdx to use z.string().min(1) instead of min(6).
  • Added two tests to __tests__/components/login-form.test.tsx: a short password (123) submits without a length error, and clearing the password still shows the required error.

The sign-up form (src/components/sign-up-form.tsx) is unchanged. It already checks password length (MIN_PASSWORD_LENGTH = 6, error auth.signUp.error.shortPassword) and that the password confirmation matches.


Why did you do this?

Password strength and length rules belong where a password is created (sign-up), not where it is checked (sign-in). Checking length on sign-in adds nothing: the backend decides whether the credentials are valid. It can also block users whose passwords were set under different rules, or by another client.

Who/what does this impact?

  • Sign-in screen only: users can submit any non-empty password. An empty password still shows "Password is required". An invalid email still shows the existing format error.
  • Sign-up and update password flows are unchanged.
  • Projects created from this template that reference auth.signIn.validation.passwordMinChars will need to drop that reference. Nothing in this repo still uses it.

Layer 2: Risk Classification

Author applies a risk label when opening the PR. When in doubt, escalate.

Label When to use
risk:low Config, copy, minor UI tweaks. Low blast radius.
risk:medium Feature work, refactors touching multiple files.
risk:high Auth, payments, migrations, security-sensitive code.

Setup

  • Create risk:low, risk:medium, risk:high labels in the repo
  • Add risk criteria to contributing guide or PR template
  • Add reminder in PR template to apply the label before requesting review
  • Define who can override/escalate (suggested: tech lead)

How did you test this?

  • Tested on iOS
  • Tested on Android
  • Tested on a small device
  • Tested on a real device
  • Tested all flows related with this PR changes
  • Tested accessibility
  • Added tests

Verification

  • pnpm lint: passed
  • pnpm type-check: passed
  • pnpm lint:translations: passed
  • pnpm test: passed (28 suites, 141 tests), including __tests__/components/login-form.test.tsx and __tests__/components/sign-up-form.test.tsx
  • Not checked on a device, simulator or emulator.

How to test locally

  1. pnpm install
  2. pnpm test -- __tests__/components/login-form.test.tsx __tests__/components/sign-up-form.test.tsx
  3. Optional, in the app (pnpm start, then open on iOS, Android or web):
    • On Sign In, enter a valid email and a short password such as 123, then tap Login. No length error should appear, and the form should submit.
    • Clear the password and tap Login. "Password is required" should appear.
    • On Sign Up, enter a password shorter than 6 characters. "Password must be at least 6 characters" should still appear.

Notes:

Assumptions:

  • An empty password still counts as missing on sign-in and shows the existing "Password is required" message. No new translation key was added for this.
  • Sign-up keeps its 6-character minimum and password confirmation check as they are.
  • The auth.signIn.validation.passwordMinChars translation key was removed because nothing uses it anymore.
  • The update password screen (src/app/update-password.tsx) has its own minimum length rule for new passwords. It is out of scope and was not changed.

Screenshots / Previews

No UI layout changes. The only visible difference is that the length error no longer appears on the sign-in form.

@devs-rootstrap
devs-rootstrap requested a review from a team as a code owner November 10, 2026 12:06
@devs-rootstrap
devs-rootstrap requested review from amaury901130, asdolo and fernandatoledo and a balanced review from Copilot November 10, 2026 12:06
@devs-rootstrap devs-rootstrap added the risk:low Config, copy, minor UI tweaks. Low blast radius. label Nov 10, 2026
@github-actions

Copy link
Copy Markdown

💯 Test Coverage

Lines Statements Branches Functions
Coverage: 56%
56.16% (346/616) 59.18% (174/294) 48.76% (118/242)

😎 Tests Results

Tests Skipped Failures Errors Time
141 0 💤 0 ❌ 0 🔥 34.505s ⏱️
👀 Tests Details • (56%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files56.1659.1848.7656.82 
src/components97.4310087.597.43 
   login-form.tsx10010066.66100 

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The review still lists an active nit in src/components/login-form.tsx at line 18.

1 open issue
What changed in this PR

Overall Review: ai:clean

Removes password-length validation from sign-in so existing credentials are not blocked by client-side password-creation rules. No actionable issues identified.

Changes:

  • Accepts any non-empty sign-in password while preserving required-field validation.
  • Removes the unused length-error translation and updates the form examples.
  • Adds regression tests for short passwords and cleared password fields.
File Description
src/​translations/​en.json Removes the unused sign-in password-length message.
src/​components/​login-form.tsx Replaces the six-character minimum with a non-empty check.
docs/​src/​content/​docs/​ui-and-theme/​Forms.mdx Aligns both form examples with non-empty password validation.
__tests__/​components/​login-form.test.tsx Tests short-password submission and required errors after clearing.

Review effort: Balanced

password: string({
required_error: translate('auth.signIn.validation.passwordRequired'),
}).min(MIN_CHARS, translate('auth.signIn.validation.passwordMinChars')),
}).min(1, translate('auth.signIn.validation.passwordRequired')),

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Config, copy, minor UI tweaks. Low blast radius.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants