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
| def checkpass(failures=[]) :
""" Collect 1's for every failure and quit program in case of failure_max failures """
#print(firstnamevar.get(), lastnamevar.get())
global b
connect()
cur = conn.cursor()
cur.execute("set client_encoding to 'UTF8'; SELECT * from firsttable")
rows = cur.fetchall()
if rows :
a = StringVar()
b = StringVar()
b = []
a = ''
for z in rows:
a = (z[3].strip(),z[4].strip())
b.append(a)
print b
if (uservar.get(), passvar.get()) in b:
print('Logged in')
Interface1()
return
failures.append(1)
if sum(failures) >= failure_max:
fenetre.destroy()
raise SystemExit('Unauthorized login attempt')
else:
lab1.config(text='Try again. Essai : %i/%i' % (sum(failures)+1, failure_max)) |