1
0
tl-vikunja/frontend/src/helpers/validatePasswort.ts
kolaente 10edeafa46
fix(password): validate password before sending request to api
(cherry picked from commit eb95caf757c05f61d8bc705df62e595903e509d5)
2024-09-20 14:25:42 +02:00

15 lines
365 B
TypeScript

export function validatePassword(password: string, validateMinLength: boolean = true): string | true {
if (password === '') {
return 'user.auth.passwordRequired'
}
if (validateMinLength && password.length < 8) {
return 'user.auth.passwordNotMin'
}
if (validateMinLength && password.length > 250) {
return 'user.auth.passwordNotMax'
}
return true
}