New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

check-password-strength

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-password-strength - npm Package Compare versions

Comparing version

to
1.0.12

2

index.js

@@ -61,3 +61,3 @@ module.exports = (password) => {

const mediumRegex = new RegExp(
`^((${lowerCaseRegex}${upperCaseRegex})|(${lowerCaseRegex}${numericRegex})|(${upperCaseRegex}${numericRegex}))(?=.{6,})`
`^((${lowerCaseRegex}${upperCaseRegex})|(${lowerCaseRegex}${numericRegex})|(${upperCaseRegex}${numericRegex})|(${upperCaseRegex}${symbolsRegex})|(${lowerCaseRegex}${symbolsRegex})|(${numericRegex}${symbolsRegex}))(?=.{6,})`
);

@@ -64,0 +64,0 @@

@@ -11,2 +11,14 @@ const app = require("./index");

it("Should return strength id 1 if password has two combination of symbol + lowercase", () => {
expect(app("asdf!@#$").id).toBe(1);
});
it("Should return strength id 1 if password has two combination of symbol + uppercase", () => {
expect(app("ASDF!@#$").id).toBe(1);
});
it("Should return strength id 1 if password has two combination of symbol + numeric", () => {
expect(app("1234!@#$").id).toBe(1);
});
it("Should return strength id 0 if password is weak", () => {

@@ -24,2 +36,15 @@ expect(app("a").id).toBe(0);

// pass combination
it("Should return strength value 'Medium' if password has two combination of symbol + lowercase", () => {
expect(app("asdf!@#$").value).toBe("Medium");
});
it("Should return strength value 'Medium' if password has two combination of symbol + uppercase", () => {
expect(app("ASDF!@#$").value).toBe("Medium");
});
it("Should return strength value 'Medium' if password has two combination of symbol + numeric", () => {
expect(app("1234!@#$").value).toBe("Medium");
});
it("Should return strength value 'Weak' if password is weak", () => {

@@ -26,0 +51,0 @@ expect(app("a").value).toBe("Weak");

@@ -0,0 +0,0 @@ MIT License

{
"name": "check-password-strength",
"version": "1.0.11",
"version": "1.0.12",
"description": "A NPM Password strength checker based from Javascript RegExp. Check passphrase if it's \"Weak\", \"Medium\" or \"Strong\"",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -59,3 +59,3 @@

`^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})"`
`^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[!@#\$%\^&\*])|((?=.*[a-z])(?=.*[!@#\$%\^&\*])|((?=.*[0-9])(?=.*[!@#\$%\^&\*]))(?=.{6,})"`

@@ -69,7 +69,13 @@ |RegEx| Desc. |

|(?=._[!@#\$%\^&_]) | The string must contain at least one special character, but we are escaping reserved RegEx characters to avoid conflict
| (?=.{8,}) | The string must be eight characters or longer
| (?=.{8,}) | The string must be eight characters or longer for strong strength
| (?=.{6,}) | Mininum of 6 characters for medium strength
## Other resources
Credits to Nic Raboy for his awesome [blog!](https://www.thepolyglotdeveloper.com/2015/05/use-regex-to-test-password-strength-in-javascript/)
If you're working with .net core project, I've created a simple nuget package with same RegEx strings to validate a password strength.
You can easily install via Nuget Package Manager or .NET CLI ([Check.Password.Strength](https://github.com/deanilvincent/Check.Password.Strength)). This package uses Regular Expression `new Regex()` derives from `System.Text.RegularExpressions`. You can use this especially if you want to validate the passcode strength on backend services or web apis of your project.
Reference [blog](https://www.thepolyglotdeveloper.com/2015/05/use-regex-to-test-password-strength-in-javascript/).
### Contribute

@@ -76,0 +82,0 @@

Sorry, the diff of this file is not supported yet