Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

validate-password

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate-password - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

examples/vanilla-js/index.html

2

package.json
{
"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;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc