-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
40 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from Modules.Colours import * | ||
from cryptography.fernet import Fernet | ||
|
||
def password_function(): | ||
|
||
file = open('../temp/key.txt','rb') | ||
key = file.read() | ||
file.close() | ||
|
||
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> ") | ||
fernet = Fernet(key) | ||
encrypted = fernet.encrypt(password) | ||
|
||
file = open('../temp/password.txt', 'w') | ||
file.write(encrypted) | ||
green("Your password has been saved successfully") | ||
cyan("Relaunch the application to continue.") | ||
grey("Press enter to exit...") | ||
input() | ||
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters