Credential validation
Project description
#Account credentials checker
This package takes care of verifing the credentials serverside.
##Download You can pip install by
pip3 install Credentials-Validator
##Usage
You can import the pakage by typing
from Credentials_Validator import UsernameValidator, PasswordValidator
The general use is:
from Credentials_Validator import UsernameValidator
user = UsernameValidator([4], #length
[1], #lower-case chars range
[1], #upper-case chars range
[1,3], #numbers range
[0,0], #symbols range
)
The use of range is:
[2, 5] # minimum 2, maximum 5 characters
[1] # at least one
[0] # not necessary, not denied
[0, 4] # not necessary, maximum 5 characters
[0, 0] # denied
###Validation
In order to validate a text
(Username or password) you have to call the method Validator.verify(text)
It returns two objects:
- a
boolean
(True
if the text is valid,False
if there is one or more errors) - a
string
, that can be:''
empty, if there are no errors'length'
if thetext
is too short or too long'lower'
if there are too few or too many lower-case characters'upper'
if there are too few or too many upper-case characters'digit'
if there are too few or too many numbers'symbols'
if there are too few or too many allowed symbols
from Credentials_Validator import UsernameValidator
user = UsernameValidator([4, 10], [1], [2], [0], [1],)
is_valid, error = user.verify('PasswOrd!')
print((is_valid, error))
#returns (True, '')
is_valid, error = user.verify('PasswOrd3')
print((is_valid, error))
#returns (False, 'symbols')
is_valid, error = user.verify('Password!')
print((is_valid, error))
#returns (False, 'upper')
is_valid, error = user.verify('th1sPasswOrdist00long')
print((is_valid, error))
#returns (False, 'length')
###Customization
The default symbols are: !"#$%&'()*+,-./:;<=>?@[\]^_{|}~
You can customize the simbols by adding your custom list (string):
from Credentials_Validator import UsernameValidator
my_symbols = '!?$%&@#'
user = UsernameValidator([4, 10], [1], [1], [0], [1], symbols_list=my_symbols)
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
Built Distribution
Close
Hashes for Credentials_Validator-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f4bd9a118fccfba7f5c58f18aec52c874c04cfee38e49ffe048b610c1765bf0 |
|
MD5 | 923de64df8afff850b04fab170b9592c |
|
BLAKE2b-256 | d35852fd7698711d5ee5a20fd7d5c87a7e1183650f9991bed4c9178dc22322bd |
Close
Hashes for Credentials_Validator-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0576558559280586734dd724d25817c94243b84ef8a4a2064329b1d71c5002b2 |
|
MD5 | 20958e55ae4d614dedb7b66239f0c596 |
|
BLAKE2b-256 | ae79cc0c03fea44d83d1729d6c917c71c9b2031de9232c58f3edad91a42a4540 |