-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSecurity.py
64 lines (56 loc) · 1.34 KB
/
Security.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
from tkinter import *
from Server import server
obj = server()
passwd = "test"
def check_login_passwd():
ret = lcs(e.get(),passwd)
if(ret == {'test'}):
secwindow()
def lcs(S,T):
m = len(S)
n = len(T)
counter = [[0]*(n+1) for x in range(m+1)]
longest = 0
lcs_set = set()
for i in range(m):
for j in range(n):
if S[i] == T[j]:
c = counter[i][j] + 1
counter[i+1][j+1] = c
if c > longest:
lcs_set = set()
longest = c
lcs_set.add(S[i-c+1:i+1])
elif c == longest:
lcs_set.add(S[i-c+1:i+1])
return lcs_set
def input_func(par,Master):
obj.Access(par)
#Message(Master,text=par,width=3000).pack()
Master.destroy
def secwindow():
master = Tk()
master.title("Welcome")
master.geometry("300x200+500+300")
Label(master,text="Dept:Data,Finance,Market").pack()
Label(master,text="Dept:").pack()
ent = Entry(master)
ent.pack()
Label(master,text="Password:").pack()
E = Entry(master,show="*")
E.pack()
b = Button(master, text="OK", width=10,command=lambda: input_func(E.get(),master))
b.pack()
mainloop()
master = Tk()
master.title("Login Page")
master.geometry("300x200+500+300")
Label(master,text="UserName:").pack()
ee = Entry(master)
ee.pack()
Label(master,text="Password:").pack()
e = Entry(master,show="*")
e.pack()
b = Button(master, text="OK", width=10, command=check_login_passwd)
b.pack()
mainloop()