Can reset password

This commit is contained in:
2023-06-12 19:10:31 +02:00
parent 1bd18133b3
commit e5827656fa
6 changed files with 221 additions and 13 deletions

View File

@ -44,4 +44,18 @@ export class ServerApi {
if (config === null) throw new Error("Missing configuration!");
return config;
}
/**
* Check password against policy
*
* @returns The detected error (if any) or null if the password
* is valid
*/
static CheckPassword(pwd: string): string | null {
const constraint = this.Config.constraints.password_len;
if (pwd.length < constraint.min || pwd.length > constraint.max)
return `Le mot de passe doit comporter entre ${constraint.min} et ${constraint.max} caractères`;
return null;
}
}