diff --git a/Password Manager/src/Modules/Functions.py b/Password Manager/src/Modules/Functions.py index e039a19..779b3ab 100644 --- a/Password Manager/src/Modules/Functions.py +++ b/Password Manager/src/Modules/Functions.py @@ -50,4 +50,31 @@ def check_details(account): def destroy(): cursor.execute('DELETE from DETAILS;',) print("\nDelete",cursor.rowcount,"records\n") - conn.commit() \ No newline at end of file + conn.commit() + +def password_function(): + try: + file = open('../temp/password.txt', 'r') + password = file.read() + while(True): + entered_password = input("Enter your password \n> ") + if(password == entered_password): + green("Logged in successfully") + grey("Press any key to continue...") + input() + break + else: + red("Incorrect password") + except: + green("PASSWORD MANAGER") + cyan("-" * 25) + print("Since, this is the first time you are using Password_manager, Create a password.") + red("DO NOT FORGET THIS PASSWORD. YOU CANNOT CHANGE IT LATER.") + password = input("Enter your password \n> ") + file = open('../temp/password.txt', 'w') + file.write(password) + green("Your password has been saved successfully") + cyan("Relaunch the application to continue.") + grey("Press enter to exit...") + input() + sys.exit(0) \ No newline at end of file diff --git a/Password Manager/src/Password_manager.py b/Password Manager/src/Password_manager.py index b78ba2d..d1e4adc 100644 --- a/Password Manager/src/Password_manager.py +++ b/Password Manager/src/Password_manager.py @@ -15,31 +15,7 @@ except: pass - try: - file = open('../temp/password.txt', 'r') - password = file.read() - while(True): - entered_password = input("Enter your password \n> ") - if(password == entered_password): - green("Logged in successfully") - grey("Press any key to continue...") - input() - break - else: - red("Incorrect password") - except: - green("PASSWORD MANAGER") - cyan("-" * 25) - print("Since, this is the first time you are using Password_manager, Create a password.") - red("DO NOT FORGET THIS PASSWORD. YOU CANNOT CHANGE IT LATER.") - password = input("Enter your password \n> ") - file = open('../temp/password.txt', 'w') - file.write(password) - green("Your password has been saved successfully") - cyan("Relaunch the application to continue.") - grey("Press enter to exit...") - input() - sys.exit(0) + password_function() conn = sqlite3.connect('../assets/Database.db') cursor = conn.cursor()