Update auth.py - Improve password messaging

Added colors and better wording for creating and entering encryption password
This commit is contained in:
ThioJoe
2023-03-19 15:45:45 -07:00
parent 689cc74a4d
commit 9af19a6602

View File

@@ -238,7 +238,9 @@ def derive_key_from_password(password, salt):
def encrypt_file(fileName=None, fileData=None):
# Use 64 Bytes (512 bits) of salt (random data) - Unless changed above
salt = os.urandom(SALT_BYTES)
password = getpass('Enter a password to encrypt the file: ')
print(f"\n{F.LIGHTGREEN_EX}Choose a password{S.R} to encrypt the login credential file (token.pickle). {F.YELLOW}NOTE: No characters will be displayed while typing.{S.R}")
password = getpass('Password: ')
key = derive_key_from_password(password, salt)
fernet = Fernet(key)
@@ -272,7 +274,7 @@ def decrypt_file(filename):
# Loop until password is correct
while success==False:
try:
print(f"\nEnter the token file decryption password. {F.YELLOW}NOTE: No characters will be displayed while typing.{S.R}")
print(f"\n{F.LIGHTRED_EX}Enter your password{S.R} to decrypt the login credential file (token.pickle.encrypted) {F.YELLOW}NOTE: No characters will be displayed while typing.{S.R}")
password = getpass('Password: ')
with open(filename, 'rb') as encrypted_file: