diff --git a/keyvault.py b/keyvault.py index 979d5c7..81cf19b 100644 --- a/keyvault.py +++ b/keyvault.py @@ -22,8 +22,8 @@ def database_enc(): for _ in range(3): try: password = gp(prompt = "Enter master password: ") - conn.execute(f"PRAGMA key = {password}") - conn.execute(''' + cursor.execute(f"PRAGMA key = {password}") + cursor.execute(''' CREATE TABLE IF NOT EXISTS data ( id INTEGER PRIMARY KEY AUTOINCREMENT, service TEXT, @@ -56,7 +56,7 @@ def database_enc(): break else: print("Both of the passwords are different. Please enter the same password.") - conn.execute(f"PRAGMA key = {mp}") + cursor.execute(f"PRAGMA key = {mp}") conn.commit() def gen(): @@ -69,14 +69,20 @@ def gen(): print(username) elif userpass == 'p': while True: - length = int(input("Enter password length (above 8 only): ")) + try: + length = int(input("Enter password length (above 8 only): ")) + except ValueError: + length = 16 + print("Password length not specified. Defaulting to 16.") if length <= 7: print("The password is too short. Please enter it again.") else: + pool = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`~@#$%^&*()-_=+]}[{\"';:.>,,