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

checkPassword

The checkPassword function validates a password based on specified criteria, including length, uppercase and lowercase letters, numeric characters, and optional symbol checks.

Works in: HTML5, React JS, Node.js

ParameterTypeDefaultDescription
passwordstringundefinedThe password to be checked.
includeSymbolsCheckbooleanfalseFlag to determine if symbols check is required (default: false).
minLengthnumber8The minimum length required for the password (default: 8).
maxLengthnumber20The maximum length allowed for the password (default: 20).
userSymbolRegexRegExp | string-Custom regular expression or string representing symbols to check (default: "").

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

See also

Last updated on