From 7d3a0d6bd97889c11bb2ec741f0f308613602c6d Mon Sep 17 00:00:00 2001 From: ASPP Student Date: Mon, 26 Aug 2024 15:26:04 +0300 Subject: [PATCH] hash password upon creation --- auth.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/auth.py b/auth.py index 1559a08..2349347 100644 --- a/auth.py +++ b/auth.py @@ -6,6 +6,7 @@ PWDB_PATH = 'pwdb.json' def get_credentials(): username = input('Enter your username: ') + password = hash_psw(getpass('Enter your password: ')) password = getpass('Enter your password: ') return (username, password) @@ -13,6 +14,7 @@ def authenticate(username, password, pwdb): return password == pwdb[username] def add_user(username, pwdb): + pwdb[username] = hash_psw(input(f'Enter password for {username}: ')) pwdb[username] = input(f'Enter password for {username}: ') return pwdb