auth.ValidatePassword checks every way a password is set: setup, registration, profile, admin create and reset, reset by mail. Same rule in the browser before sending (lib/password.ts), with our own German message instead of the browser popup. Existing shorter passwords still log in. Profile and admin reset no longer trim the password, which made passwords with surrounding spaces unusable for login. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 lines
446 B
TypeScript
9 lines
446 B
TypeScript
// Same rule as the server (auth.ValidatePassword): at least 8 characters, not only spaces.
|
|
// Only for setting a password; logging in with an older, shorter one keeps working.
|
|
export const MIN_PASSWORD_LENGTH = 8;
|
|
|
|
export const passwordProblem = (password: string): string | null =>
|
|
!password.trim() || Array.from(password).length < MIN_PASSWORD_LENGTH
|
|
? `Das Passwort muss mindestens ${MIN_PASSWORD_LENGTH} Zeichen lang sein`
|
|
: null;
|