This commit is contained in:
2026-02-16 19:34:35 +00:00
commit 9ab0940ca4
784 changed files with 41710 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import * as errors from '@@/custom-errors';
export function validatePassword(password: string | undefined): void {
if (!password || password.length < 12) {
throw errors.BAD_REQUEST('Password must be at least 12 characters');
}
if (!/[a-z]/.test(password)) {
throw errors.BAD_REQUEST('Password must contain lowercase letters');
}
if (!/[A-Z]/.test(password)) {
throw errors.BAD_REQUEST('Password must contain uppercase letters');
}
if (!/[0-9]/.test(password)) {
throw errors.BAD_REQUEST('Password must contain numbers');
}
if (!/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password)) {
throw errors.BAD_REQUEST('Password must contain special characters (!@#$%^&* etc.)');
}
}