Validates password according to flexible and intuitive specifications
Project description
password-validator
This is a python port of npm
package password-validator.
Install
pip install password-validator
Usage
from password_validator import PasswordValidator
# Create a schema
schema = PasswordValidator()
# Add properties to it
schema\
.min(8)\
.max(100)\
.has().uppercase()\
.has().lowercase()\
.has().digits()\
.has().no().spaces()\
# Validate against a password string
print(schema.validate('validPASS123'));
# => True
print(schema.validate('invalidPASS'));
# => False
Rules
Rules supported as of now are:
Rules | Descriptions |
---|---|
digits() | specifies password must include digits |
letters() | specifies password must include letters |
lowercase() | specifies password must include lowercase letters |
uppercase() | specifies password must include uppercase letters |
symbols() | specifies password must include symbols |
spaces() | specifies password must include spaces |
min(len) | specifies minimum length |
max(len) | specifies maximum length |
no([regex]) | inverts the result of validations applied next |
has([regex]) | inverts the effect of no() and applies a regex (optional) |
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
password_validator-0.2.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for password_validator-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e7359f1b97b4ada459add676c352edbe5e2d72cbfefee116666e7beb9a3e4b7 |
|
MD5 | 17b05cfac6824384c9377190ba4a7641 |
|
BLAKE2b-256 | f69333516b9a277b5e41cb10fa84d7908ae5551ee024bfea492a00eac763c272 |