FNBPasswordValidator
FNBPasswordValidator copied to clipboard
Validates passwords and helps you guarantee passwords more secure in your system.
FNBPasswordValidator
Validates passwords and helps you guarantee passwords more secure in your system.
Make sure youre users have a secure password, checking for uppercase/lowercase letters, numbers, special characters, prohibited words (e.g. their name or email address) and min/max password length.
Features
- [x] Uppercase verification
- [x] Lowercase verification
- [x] Numbers verification
- [x] Special Characters verification
- [x] Prohibited words verification
##Installation Install via NPM:
npm install fnbpasswordvalidator
Client-side
<script type="text/javascript" src="fnbpasswordvalidator.min.js"></script>
<script type="text/javascript">
var result = passwordValidator("somePassword*");
if (result.valid == false) {
alert(result.message);
}
</script>
Usage
passwordValidator.validate(password, options);
Example
var passwordValidator = require('fnbpasswordvalidator');
var password = "somePassword123*";
var passwordDetails = passwordValidator.validate(password, {prohibitedWords: [first_name, last_name, email],
min: 8,
specialCharacters: false});
if (!passwordDetails.valid) {
res.json({success: false, message: passwordDetails.message});
return;
}
Options
-
min
: Password minimum length. Default: 8 -
max
: Password maximum length. Default: 255 -
numbers
: Numbers required. Default: true -
uppercase
: Uppercase required. Default: true -
lowercase
: Lowecase required. Default: true -
specialCharacters
: Special Characters required. Default: true -
prohibitedWords
: Words to be banned from the password. Array of strings.
Contribute
We would love for you to contribute to fnbpasswordvalidator, check the LICENSE
file for more info.
Meta
Felipe N. Brito – [email protected]
Distributed under the MIT license. See LICENSE
for more information.