/
Login.py
68 lines (50 loc) · 2.01 KB
/
Login.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import database
while True:
print("////////////////////////////")
print(" Welcome ")
print("////////////////////////////")
choice = eval(input('1. Create account 2. Login 3. Quit : '))
if choice == 1:
username = input('Create username: ')
password = input('Create password: ')
def password_check(password):
SpecialSym =['$', '@', '#', '%']
val = True
if len(password) < 6:
print('length should be at least 6')
val = False
if len(password) > 20:
print('length should be not be greater than 8')
val = False
if not any(char.isdigit() for char in password):
print('Password should have at least one numeral')
val = False
if not any(char.isupper() for char in password):
print('Password should have at least one uppercase letter')
val = False
if not any(char.islower() for char in password):
print('Password should have at least one lowercase letter')
val = False
if not any(char in SpecialSym for char in password):
print('Password should have at least one of the symbols $@#')
val = False
if val:
return val
def main():
passwd = password
if (password_check(passwd)):
database.add_user(username,password)
print('Account created')
else:
print("Invalid Password !!")
if __name__ == '__main__':
main()
elif choice == 2:
database.login()
print("Login succees")
break
elif choice == 3:
break
print("////////////////////////////")
print(" Thank you ")
print("////////////////////////////")