mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 20:14:54 +00:00
Improve password validator to include more special characters
This commit is contained in:
@ -11,12 +11,12 @@ export class IsPasswordStrongConstraint
|
|||||||
{
|
{
|
||||||
validate(password: string) {
|
validate(password: string) {
|
||||||
const regex =
|
const regex =
|
||||||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
|
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~])[A-Za-z\d!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]{8,}$/;
|
||||||
return regex.test(password);
|
return regex.test(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultMessage() {
|
defaultMessage() {
|
||||||
return 'password must be at least 8 characters long and include at least one uppercase letter, one lowercase letter, one numeric digit, and one special character.';
|
return 'Password must be at least 8 characters long and include at least one uppercase letter, one lowercase letter, one numeric digit, and one special character from the set !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user