π Password Validator
Validate a password given a security policy.
Do you want to protect yourself against SQL injection and other code injections?
Use our input sanitizer tool.
Easily validate different types of data.
Usage
import DymoAPI from "dymo-api";
const dymo = new DymoAPI();
console.log(await dymo.isValidPwd({
email: "[email protected]",
password: "PASSWORD_REQ",
bannedWords: [
"CompanyName",
"UserName"
],
min: 16,
max: 42
}));
Response
All values in details are Strings.
{
valid: false,
password: "PASSWORD_REQ",
// All possible mistakes.
details: [
{
validation: "spaces",
message: "The password cannot contain spaces."
},
{
validation: "bannedWords",
message: "The password cannot contain the word \"foundWord\".",
word: "foundWord"
},
{
validation: "hasSql",
message: "Password injections are not allowed."
},
{
validation: "blacklist",
message: "The password is too common."
},
{
validation: "min",
message: "The password must be at least 8 characters long."
},
{
validation: "max",
message: "The password must be no longer than 100 characters."
},
{
validation: "digits",
message: "The password must have at least 2 digits."
},
{
validation: "letters",
message: "The password must have upper and lower case letters."
},
{
validation: "symbols",
message: "The password must contain at least one special symbol/character."
},
{
validation: "email",
message: "The email user and password cannot match."
},
{
validation: "userEmail",
message: "The email user and password cannot match."
}
]
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
password | String | β | Refers to the password to be validated |
email | String | β | Refers to the email address linked to the password to be validated |
bannedWords | banned_words | String[] (0-10) | β | Refers to the forbidden words in the password |
min | Integer (8 - 32) | β | Refers to the minimum length of the password |
max | Integer (32- 100) | β | Refers to the maximum length of the password |