Skip to Content
NFSFU234FormValidation v3 is here — file upload validation, config-driven rules, and more.
v3 (current)checkPassword

checkPassword

Validates a password against length and (optionally) symbol requirements. Returns: string \| boolean

ParameterTypeRequiredDefaultDescription
passwordstringrequired-The password to check.
minLengthnumberoptional8Minimum allowed length. Defaults to 8.
maxLengthnumberoptional20Maximum allowed length. Defaults to 20.
includeSymbolsCheckbooleanoptionalfalseWhether the password must contain a symbol. Defaults to false.
userSymbolRegex`string \RegExp`optional''
Usage
Example: Validate Password
const isStrongPassword = nfsfu234FormValidation.checkPassword('StrongP@ssword123'); console.log("isStrongPassword: ", isStrongPassword); // true or error message
Example: Validate Password with Symbol Check
const isStrongPassword = nfsfu234FormValidation.checkPassword('StrongP@ssword123', true); console.log("isStrongPassword: ", isStrongPassword); // true or error message
Example: Validate Password with Symbol Check With Custom Regex
const isStrongPasswordWithSymbols = nfsfu234FormValidation.checkPassword('StrongP@ssword123', true, 8, 20, '[!@#$%^&*()]'); console.log("isStrongPasswordWithSymbols: ", isStrongPasswordWithSymbols); // true or error message
Last updated on