mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-22 06:41:46 +00:00
chore: apply prettier on the entire project
This commit is contained in:
@@ -1,10 +1,34 @@
|
||||
const COMMON_PASSWORDS = new Set([
|
||||
'password', '12345678', '123456789', '1234567890', 'password1',
|
||||
'qwerty123', 'iloveyou', 'admin123', 'letmein12', 'welcome1',
|
||||
'monkey123', 'dragon12', 'master12', 'qwerty12', 'abc12345',
|
||||
'trustno1', 'baseball', 'football', 'shadow12', 'michael1',
|
||||
'jennifer', 'superman', 'abcdefgh', 'abcd1234', 'password123',
|
||||
'admin1234', 'changeme', 'welcome123', 'passw0rd', 'p@ssword',
|
||||
'password',
|
||||
'12345678',
|
||||
'123456789',
|
||||
'1234567890',
|
||||
'password1',
|
||||
'qwerty123',
|
||||
'iloveyou',
|
||||
'admin123',
|
||||
'letmein12',
|
||||
'welcome1',
|
||||
'monkey123',
|
||||
'dragon12',
|
||||
'master12',
|
||||
'qwerty12',
|
||||
'abc12345',
|
||||
'trustno1',
|
||||
'baseball',
|
||||
'football',
|
||||
'shadow12',
|
||||
'michael1',
|
||||
'jennifer',
|
||||
'superman',
|
||||
'abcdefgh',
|
||||
'abcd1234',
|
||||
'password123',
|
||||
'admin1234',
|
||||
'changeme',
|
||||
'welcome123',
|
||||
'passw0rd',
|
||||
'p@ssword',
|
||||
]);
|
||||
|
||||
export function validatePassword(password: string): { ok: boolean; reason?: string } {
|
||||
@@ -18,7 +42,8 @@ export function validatePassword(password: string): { ok: boolean; reason?: stri
|
||||
return { ok: false, reason: 'Password is too common. Please choose a unique password.' };
|
||||
}
|
||||
|
||||
const requirementsMessage = 'Password must contain at least one uppercase letter, one lowercase letter, one number, and one special character';
|
||||
const requirementsMessage =
|
||||
'Password must contain at least one uppercase letter, one lowercase letter, one number, and one special character';
|
||||
if (!/[A-Z]/.test(password)) return { ok: false, reason: requirementsMessage };
|
||||
if (!/[a-z]/.test(password)) return { ok: false, reason: requirementsMessage };
|
||||
if (!/[0-9]/.test(password)) return { ok: false, reason: requirementsMessage };
|
||||
|
||||
Reference in New Issue
Block a user