-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathadmin.py
45 lines (39 loc) · 1.53 KB
/
admin.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
import csv
class Admin:
def __init__(self):
self.username = None
self.password = None
def adminRegistration(self):
print("----------------------------")
print()
with open("adminCredential.csv", 'w',newline="") as f:
w = csv.writer(f)
self.username = input("Enter and set username:")
self.password = input("Enter and set your password:")
#saving a data in database
w.writerow([self.username,self.password])
print("Registration succesfully")
print()
print("--------------------------------")
def adminLogin(self):
actList = [] #list for storing data and reterieving from admin credential.csv file
with open("adminCredential.csv", 'r+',newline="") as f:
r = csv.reader(f)
data = list(r)
for i in data:
for j in i:
actList.append(j)
#print actList
while(True):
print("---------------------")
print()
self.username = input("Enter username :")
self.password = input("Enter password :")
if self.username == str(actList[0]) and self.password == str(actList[1]):
print()
print("Login successfully")
break
else:
print("Enter correct username and password")
print()
print("------------------------------------------")