MCPcopy Create free account
hub / github.com/PalisadoesFoundation/talawa-api / validateSecurePassword

Function validateSecurePassword

scripts/setup/validators.ts:113–129  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

111 * @returns `true` if valid, or an error message string if invalid.
112 */
113export function validateSecurePassword(input: string): true | string {
114 if (!input.trim()) return "Password is required";
115 if (input.length < 8) return "Password must be at least 8 characters long";
116 if (!/[A-Z]/.test(input)) {
117 return "Password must contain at least one uppercase letter";
118 }
119 if (!/[a-z]/.test(input)) {
120 return "Password must contain at least one lowercase letter";
121 }
122 if (!/[0-9]/.test(input)) {
123 return "Password must contain at least one number";
124 }
125 if (!/[!@#$%^&*()]/.test(input)) {
126 return "Password must contain at least one special character (!@#$%^&*())";
127 }
128 return true;
129}
130
131/**
132 * Validates CloudBeaver server URL format.

Callers 1

apiSetup.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected