Use a single password_hash function

Using two different functions makes no sense in Python. A single
function with an optional argument is more Pythonistic.
This commit is contained in:
Rodolphe Breard 2017-12-17 13:07:07 +01:00
parent cd287242b0
commit 935b0acf26
2 changed files with 2 additions and 5 deletions

View file

@ -63,10 +63,7 @@ class LibreAuthPassError(Exception):
else:
self.message = 'unknown error'
def password_hash(password):
return password_hash_standard(password, NOSTANDARD)
def password_hash_standard(password, standard):
def password_hash(password, standard=NOSTANDARD):
pass_len = len(password)
if pass_len < PASSWORD_MIN_LEN:
raise LibreAuthPassError(1)