Compare commits
2 commits
33720c9b63
...
de4dc255ac
Author | SHA1 | Date | |
---|---|---|---|
|
de4dc255ac | ||
|
487f0f9597 |
4
auth.py
4
auth.py
|
@ -14,7 +14,7 @@ def authenticate(username, hashed_password, pwdb):
|
||||||
return hashed_password == pwdb[username]
|
return hashed_password == pwdb[username]
|
||||||
|
|
||||||
def add_user(username, pwdb):
|
def add_user(username, pwdb):
|
||||||
pwdb[username] = pwhash(getpass(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):
|
||||||
|
@ -36,6 +36,8 @@ def pwhash(pwd):
|
||||||
m.update(encoded_pwd)
|
m.update(encoded_pwd)
|
||||||
return m.hexdigest()
|
return m.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
PWDB_PATH = 'pwdb.json'
|
PWDB_PATH = 'pwdb.json'
|
||||||
pwdb = read_pwdb(PWDB_PATH)
|
pwdb = read_pwdb(PWDB_PATH)
|
||||||
|
|
Loading…
Reference in a new issue