Remove limits from password in dev

This commit is contained in:
Adria Navarro 2024-01-02 16:58:47 +01:00
parent 780a0ee687
commit b0a12e034d
1 changed files with 7 additions and 0 deletions

View File

@ -1,9 +1,16 @@
import { env } from ".."
export const PASSWORD_MIN_LENGTH = 8 export const PASSWORD_MIN_LENGTH = 8
export const PASSWORD_MAX_LENGTH = 512 export const PASSWORD_MAX_LENGTH = 512
export function validatePassword( export function validatePassword(
password: string password: string
): { valid: true } | { valid: false; error: string } { ): { valid: true } | { valid: false; error: string } {
if (env.isDev() && !env.isTest() && password) {
// We accept any password while on development
return { valid: true }
}
if (!password || password.length < PASSWORD_MIN_LENGTH) { if (!password || password.length < PASSWORD_MIN_LENGTH) {
return { return {
valid: false, valid: false,