fix(auth): disallow emojis in password

This commit is contained in:
ShivaniKhaire 2026-10-08 16:54:04 +05:30
parent fef1751c55
commit 5bab113a24
1 changed files with 5 additions and 1 deletions

View File

@ -72,11 +72,15 @@ export default function SignUpForm() {
} else if (!/[0-9]/.test(password)) {
setPasswordError("Password must contain at least one number (0-9)");
hasError = true;
} else if (!/[^A-Za-z0-9\s]/.test(password)) {
} else if (/\p{Extended_Pictographic}/u.test(password)) {
setPasswordError("Password must not contain emojis");
hasError = true;
} else if (!/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?`~]/.test(password)) {
setPasswordError("Password must contain at least one special character (!@#$)");
hasError = true;
}
if (!confirmPassword) {
setConfirmPasswordError("Please confirm your password");
hasError = true;