Hello to all.
I am getting more hurdles while trying for the validation for the login from.
I did a small project , but i am unable to set the validation for the main login form.
I am using some simple logics.
try:
import os
import MySQLdb,md5
import bz2
import _mysql_exceptions as DB_EXC
cxn = MySQLdb.connect(user ='root')
cur = cxn.cursor()
#no = cur.execute("insert into security.security values(%s,%s,%s)",(userid,password,entrylevel))
#pwd=raw_input("enter a text:")
##t=bz2.compress(password)
##print "the encypted text is %s ", t
##no=cur.execute("insert into security.security values(%s, %s,%s )",(userid,t,entrylevel))
#no = cur.execute("select * from security.security where userid=%s and password=%s and entrylevel=%s",(userid,password,entrylevel))
#st = cur.execute("update venlabs.users set password=MD5(password) where name=%s", (name))
if (userid == "" and password == ""):
tkMessageBox.showinfo("Text", "invalid userid " )
guiFrame.destroy()
try:
guiFrame.destroy()
root.destroy()
except:
pass
#welcome.Welcomescreen(self.master)
elif (len(password)==8):
t=bz2.compress(password)
print "the encypted text is %s ", t
no=cur.execute("insert into security.security values(%s, %s,%s )",(userid,t,entrylevel))
tkMessageBox.showinfo("Text", "successfully userid and password created")
else:
tkMessageBox.showinfo("Text", "invalid password " )
self.destroy()
cur.close()
cxn.commit()
cxn.close()
except ImportError , e:
return None
Here, i need encryption for the first time entry in the login form which is encrypted in the database.
It is working.
Afterwords, if the same person enters next time, then the encrypted password must decrypt and matches to it and enter into it.
And also , i need help for validation the password field for the "length" and "strings".
So, help needy.
Regards
Bhanu