/
account_manager.py
78 lines (66 loc) · 2.19 KB
/
account_manager.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
68
69
70
71
72
73
74
75
76
77
78
import users
import rich_client
import administrator
import passenger
import users_database_manager
import lines_database_manager
def main():
print("WELCOME!")
print("This is EllitsaAirlines!")
while True:
print("\nTo log in press 1")
print("To register press 2")
print("To exit press 3")
choice = input("What do you want to do? ")
choice = int(choice)
if choice == 1:
login()
elif choice == 2:
register()
elif choice == 3:
break
else:
print("\nWrong number!")
def login():
name = input("Username: ")
name = str(name)
password = input("Password: ")
password = str(password)
if users.check_category(name, password) == 1:
administrator.show_admin_options(name)
elif users.check_category(name, password) == 2:
passenger.show_passenger_options(name)
elif users.check_category(name, password) == 3:
rich_client.show_rich_client_options(name)
else:
print("\nWrong name ot password!")
def define_regisration_type():
print("\nOK now what type of user are you??")
print("For administrator press 1")
print("For passenger press 2")
print("For rich client press 3")
print("To exit press 4")
choice = input("Take your choice and be honest! ")
choice = int(choice)
return choice
def register():
choice = define_regisration_type()
name = input("Enter name: ")
name = str(name)
password = input("Enter password: ")
password = str(password)
if choice == 1:
if administrator.register_if_possible(name, password):
print("""\nSuccessfully registered administrator with
name {0} and password {1}""".format(name, password))
elif choice == 2:
if passenger.register_if_possible(name, password):
print("""\nYou were successfully regitered in the system :)
Check your email for security code""")
elif choice == 3:
if rich_client.register_if_possible(name, password):
print("\nYou were successfully regitered in the system")
else:
print("\nWrong number!")
if __name__ == '__main__':
main()