fixed the password visibility problem #3

Merged
otizonaizit merged 2 commits from victoriash/2025-plovdiv-git:fix into main 2025-09-22 14:29:45 +02:00

View file

@ -1,16 +1,17 @@
import getpass # hides types characters, very useful

maybe add a comment to explain what getpass does?

maybe add a comment to explain what `getpass` does?
import json import json
import sys import sys
def get_credentials(): def get_credentials():
username = input('Enter your username: ') username = input('Enter your username: ')
password = input('Enter your password: ') password = getpass.getpass('Enter your password: ')
return (username, password) return (username, password)
def authenticate(username, password, pwdb): def authenticate(username, password, pwdb):
return password == pwdb[username] return password == pwdb[username]
def add_user(username, pwdb): def add_user(username, pwdb):
pwdb[username] = input(f'Enter password for {username}: ') pwdb[username] = getpass.getpass(f'Enter password for {username}: ')
return pwdb return pwdb
def read_pwdb(pwdb_path): def read_pwdb(pwdb_path):