make use of pwdhash
This commit is contained in:
parent
65d0aae9c9
commit
33720c9b63
10
auth.py
10
auth.py
|
@ -7,14 +7,14 @@ PWDB_PATH = 'pwdb.json'
|
|||
|
||||
def get_credentials():
|
||||
username = input('Enter your username: ')
|
||||
password = getpass('Enter your password: ')
|
||||
return (username, password)
|
||||
hashed_password = pwhash(getpass('Enter your password: '))
|
||||
return (username, hashed_password)
|
||||
|
||||
def authenticate(username, password, pwdb):
|
||||
return password == pwdb[username]
|
||||
def authenticate(username, hashed_password, pwdb):
|
||||
return hashed_password == pwdb[username]
|
||||
|
||||
def add_user(username, pwdb):
|
||||
pwdb[username] = getpass(f'Enter password for {username}: ')
|
||||
pwdb[username] = pwhash(getpass(f'Enter password for {username}: '))
|
||||
return pwdb
|
||||
|
||||
def read_pwdb(PWDB_PATH):
|
||||
|
|
Loading…
Reference in a new issue