implement sha256 hashing of password for security reason #7
10
auth.py
10
auth.py
|
@ -7,14 +7,14 @@ PWDB_PATH = 'pwdb.json'
|
||||||
|
|
||||||
def get_credentials():
|
def get_credentials():
|
||||||
username = input('Enter your username: ')
|
username = input('Enter your username: ')
|
||||||
password = getpass('Enter your password: ')
|
hashed_password = pwhash(getpass('Enter your password: '))
|
||||||
return (username, password)
|
return (username, hashed_password)
|
||||||
|
|
||||||
def authenticate(username, password, pwdb):
|
def authenticate(username, hashed_password, pwdb):
|
||||||
return password == pwdb[username]
|
return hashed_password == pwdb[username]
|
||||||
|
|
||||||
def add_user(username, pwdb):
|
def add_user(username, pwdb):
|
||||||
pwdb[username] = input(f'Enter password for {username}: ')
|
pwdb[username] = pwhash(input(f'Enter password for {username}: '))
|
||||||
return pwdb
|
return pwdb
|
||||||
|
|
||||||
def read_pwdb(PWDB_PATH):
|
def read_pwdb(PWDB_PATH):
|
||||||
|
|
Loading…
Reference in a new issue