mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Some checks failed
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Test / docker (push) Has been cancelled
Runs E2E API Tests / build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (22.x) (push) Has been cancelled
Mirror main branch to main-mirror-for-wdb / lint_and_build (push) Has been cancelled
Publish Docs / run (push) Has been cancelled
Run setup tests / test (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
17 lines
404 B
TypeScript
17 lines
404 B
TypeScript
import { KnownErrors } from "..";
|
|
|
|
const minLength = 8;
|
|
const maxLength = 70;
|
|
|
|
export function getPasswordError(password: string): KnownErrors["PasswordRequirementsNotMet"] | undefined {
|
|
if (password.length < minLength) {
|
|
return new KnownErrors.PasswordTooShort(minLength);
|
|
}
|
|
|
|
if (password.length > maxLength) {
|
|
return new KnownErrors.PasswordTooLong(maxLength);
|
|
}
|
|
|
|
return undefined;
|
|
}
|