-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser authentication
More file actions
142 lines (108 loc) · 4.05 KB
/
user authentication
File metadata and controls
142 lines (108 loc) · 4.05 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
from tkinter import *
from tkinter import messagebox
import mysql.connector as sql
mycon = sql.connect(host='localhost', user='root', passwd='Kamble@12', database='db1')
cur = mycon.cursor()
def f2():
global frame2
frame1.destroy()
frame2 = Frame(root, height=500, width=700, bg='#D3D3D3')
frame2.place(x=0, y=0)
l0 = Label(frame2, text='LOGIN SUCCESSFUL', font=('normal', 25, 'bold'), bg='#D3D3D3')
l0.place(x=230, y=90)
b1 = Button(frame2, text='LOG OUT', font=('normal', 15), command=f)
b1.place(x=330, y=300)
def submit():
cur.execute('select email,pass from info')
total = cur.fetchall()
username = t1.get()
password = t2.get()
for i in total:
if username == i[0] and password == i[1]:
return f2()
elif username == i[0] and password != i[1]:
messagebox.showinfo('ALERT!', 'ENTER CORRECT PASSWORD')
e2.delete(0, END)
break
else:
messagebox.showinfo('ALERT!', 'ACCOUNT IS NOT REGISTERED')
e1.delete(0, END)
e2.delete(0, END)
def f1():
global t1, t2, frame1, e1, e2
try:
frame2.destroy()
except:
pass
frame1 = Frame(root, height=500, width=700, bg='#D3D3D3')
frame1.place(x=0, y=0)
l0 = Label(frame1, text='LOGIN PAGE', font=('normal', 25, 'bold'), bg='#D3D3D3')
l0.place(x=230, y=90)
l1 = Label(frame1, text='USERNAME', font=('arial', 15, 'normal'), bg='#D3D3D3')
l1.place(x=150, y=195)
l2 = Label(frame1, text='PASSWORD', font=('arial', 15, 'normal'), bg='#D3D3D3')
l2.place(x=150, y=230)
t1 = StringVar()
t2 = StringVar()
e1 = Entry(frame1, width=20, font=('normal', 15), bd=3, textvariable=t1)
e1.place(x=300, y=195)
e2 = Entry(frame1, width=20, font=('normal', 15), bd=3, textvariable=t2, show='*')
e2.place(x=300, y=230)
b1 = Button(frame1, text='SUBMIT', font=('normal', 15), command=submit)
b1.place(x=330, y=300)
def f():
global frame3
frame3 = Frame(root, height=500, width=700, bg='#D3D3D3')
frame3.place(x=0, y=0)
b1 = Button(frame3, text='Login', font=('normal', 15),command=f1)
b1.place(x=250, y=300)
b2 = Button(frame3, text='Register', font=('normal', 15),command=f3)
b2.place(x=330, y=300)
#b3 = Button(frame1, text='Exit', font=('normal', 15))
#b3.place(x=330, y=300)
def f3():
global t3,t4,t5,frame2
frame3.destroy()
frame2 = Frame(root, height=500, width=700, bg='#D3D3D3')
frame2.place(x=0, y=0)
l3 = Label(root, text='EMAIL', font=('arial', 15, 'normal'), bg='#D3D3D3')
l3.place(x=205, y=230)
l4 = Label(root, text='PASSWORD', font=('arial', 15, 'normal'), bg='#D3D3D3')
l4.place(x=150, y=265)
l5 = Label(root, text='CONFIRM PASSWORD', font=('arial', 15, 'normal'), bg='#D3D3D3')
l5.place(x=55, y=300)
# stringvar
#t1 = StringVar()
#t2 = StringVar()
t3 = StringVar()
t4 = StringVar()
t5 = StringVar()
e3 = Entry(root, width=20, font=('normal', 15), bd=3, textvariable=t3)
e3.place(x=300, y=230)
e4 = Entry(root, width=20, font=('normal', 15), bd=3, show='*', textvariable=t4)
e4.place(x=300, y=265)
e5 = Entry(root, width=20, font=('normal', 15), bd=3, show='*', textvariable=t5)
e5.place(x=300, y=300)
b4 = Button(root, text='SUBMIT', font=('normal', 15), bd=3, command=submit3)
b4.place(x=330, y=350)
def submit3():
mycon = sql.connect(host='localhost', user='root', passwd='Kamble@12', database='db1')
cur = mycon.cursor()
e_mail = t3.get()
passwd = t4.get()
s=("Insert into info (email,pass) values(%s,%s)")
b=(e_mail,passwd)
cur.execute(s,b)
mycon.commit()
frame2.destroy()
frame4 = Frame(root, height=500, width=700, bg='#D3D3D3')
frame4.place(x=0, y=0)
l0 = Label(frame4, text='REGISTERED SUCCESSFULLY', font=('normal', 25, 'bold'), bg='#D3D3D3')
l0.place(x=200, y=90)
b1 = Button(frame4, text='LOG IN', font=('normal', 15), command=f)
b1.place(x=330, y=300)
root = Tk()
root.title('USER AUTHENTICATION PAGE')
root.geometry('700x500')
f()
root.mainloop()