Skip to content

Commit

Permalink
Created a seperate function for application password
Browse files Browse the repository at this point in the history
  • Loading branch information
SVijayB committed Jul 8, 2020
1 parent 819d833 commit e47e7bd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
29 changes: 28 additions & 1 deletion Password Manager/src/Modules/Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,31 @@ def check_details(account):
def destroy():
cursor.execute('DELETE from DETAILS;',)
print("\nDelete",cursor.rowcount,"records\n")
conn.commit()
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)
26 changes: 1 addition & 25 deletions Password Manager/src/Password_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e47e7bd

Please sign in to comment.