validate-password
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "validate-password", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Strengthen your user's passwords", | ||
@@ -5,0 +5,0 @@ "author": "Mike DeWitt <mdewitt07@gmail.com>", |
@@ -1,1 +0,57 @@ | ||
Enforce stronger passwords for users by checking for uppercase/lowercase letters, numbers, and special characters. | ||
#Moonshine | ||
###client-side and server-side password validation | ||
Enforce stronger passwords for users by checking for uppercase/lowercase letters, numbers, and special characters. | ||
You can also check passwords for certain strings, preventing users from entering their name or email in the password, or | ||
check the password for commonly used passwords that you'd like your users to avoid... | ||
##Installation | ||
Install via NPM: | ||
``` | ||
npm install validate-password | ||
``` | ||
##Usage | ||
Moonshine can be used as a stand alone package: | ||
``` | ||
<script src="node_modules/validate-password/dist/validate-password.min.js"></script> | ||
``` | ||
or as a CommonJS module: | ||
``` | ||
var ValidatePassword = require('validate-password'); | ||
``` | ||
```Validate Password``` will accept two arguments - first, the password as a string: | ||
``` | ||
var passwordData = ValidatePassword('aaaaa'); | ||
console.log(passwordData.isValid); // false | ||
console.log(passwordData.validationMessage); // 'The password must contain at least one uppercase letter' | ||
``` | ||
And, optionally, an array of strings that are not allowed to be in the password: | ||
``` | ||
var checkPasswordForName = ValidatePassword('cat123aaBa$%^#$%#$%', ['cat123']); | ||
console.log(passwordData.isValid); // false | ||
console.log(passwordData.validationMessage); // 'The password cannot contain cat123' | ||
``` | ||
See the examples directory for more detailed use cases... | ||
@@ -12,2 +12,4 @@ module.exports = function validatePassword(password, forbiddenStrings) { | ||
} | ||
if | ||
@@ -44,5 +46,5 @@ if (!hasLowerCase(password)) { | ||
if(typeof forbiddenStrings !== 'undefined') { | ||
if (typeof forbiddenStrings !== 'undefined') { | ||
checkForbiddenStringsData = checkForbiddenStrings(password, forbiddenStrings); | ||
if(checkForbiddenStringsData.value) { | ||
if (checkForbiddenStringsData.value) { | ||
validationData.isValid = false; | ||
@@ -49,0 +51,0 @@ validationData.validationMessage = 'The password cannot contain ' + checkForbiddenStringsData.foundString; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16859
10
266
58