-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.py
More file actions
26 lines (25 loc) · 761 Bytes
/
Copy pathauth.py
File metadata and controls
26 lines (25 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def create_acc():
name = input("Enter username: ")
password = input("Enter password: ")
if len(password) < 6:
print('Password too short.')
exit()
password_repeat = input("Repeat the password: ")
if password == password_repeat:
with open('password.csv', "w") as f:
f.write(name + "\n")
f.write(password)
else:
print('Passwords dont match')
try:
with open('password.csv', "r") as f:
lines = f.readlines()
password = lines[1]
user = lines[0]
except FileNotFoundError:
create_acc()
password_ask = input(f'Enter password for {user}: '.replace('\n', ''))
if password == password_ask:
print('Acsess Granted!')
else:
print('Acsess Denied!')