From de4dc255acd7bbd2db200aad8323388ab9b2e3a6 Mon Sep 17 00:00:00 2001 From: ASPP Student Date: Mon, 26 Aug 2024 15:31:17 +0300 Subject: [PATCH] implement hashing password where needed --- auth.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/auth.py b/auth.py index 50296e3..fad77c5 100644 --- a/auth.py +++ b/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] = input(f'Enter password for {username}: ') + pwdb[username] = pwhash(input(f'Enter password for {username}: ')) return pwdb def read_pwdb(PWDB_PATH):