def check_credentials(username, password): """Verifies credentials for username and password. Returns None on success or a string describing the error on failure""" # Adapt to your needs users = db_handler.get_users() ency_pass = encrypt_handler.for_encrypt_pass(password) for u, p in users.iteritems(): print username, ency_pass if username == u and ency_pass == p: return None else: return u"Incorrect username or password."
def check_credentials(username, password): """Verifies credentials for username and password. Returns None on success or a string describing the error on failure""" # Adapt to your needs users = db_handler.get_users() ency_pass = encrypt_handler.for_encrypt_pass(password) for u, p in users.iteritems(): print username , ency_pass if username == u and ency_pass == p: return None else: return u"Incorrect username or password."
def check_credentials(username, password): """Verifies credentials for username and password. Returns None on success or a string describing the error on failure""" # Adapt to your needs users = db_handler.get_users() ency_pass = encrypt_handler.for_encrypt_pass(password) p = users.get(username) if p == None: return u"User Doest not Exist!" elif ency_pass != p: return u"Incorrect password!" else: return None
def getdata(self,uname,upasswd,action,email,phno,age,group): if action == "add": e_pass = encrypt_handler.for_encrypt_pass(upasswd) adduser = db_handler.add_user(uname,e_pass) register = db_handler.register(uname,email,phno,age,group) group_info = db_handler.insert_to_group(uname,group) html = header html += """ <h1>Status : %s <br> %s <br> %s</h1> """ % (adduser,register,group_info) elif action == "remove": adduser = db_handler.remove_user(uname) unregister = db_handler.unregister(uname,email,phno,age) remove_f_group = db_handler.delete_from_group(uname,group) html = header html += """ <h1>Status : %s <br> %s <br> %s </h1> """ % (adduser,unregister,remove_f_group) html += "<h3><a href=/>Click to continue</a></h3></div></body></html>" return html
def getdata(self, uname, upasswd, action, email, phno, age, group): if action == "add": e_pass = encrypt_handler.for_encrypt_pass(upasswd) adduser = db_handler.add_user(uname, e_pass) register = db_handler.register(uname, email, phno, age, group) group_info = db_handler.insert_to_group(uname, group) html = header html += """ <h1>Status : %s <br> %s <br> %s</h1> """ % ( adduser, register, group_info) elif action == "remove": adduser = db_handler.remove_user(uname) unregister = db_handler.unregister(uname, email, phno, age) remove_f_group = db_handler.delete_from_group(uname, group) html = header html += """ <h1>Status : %s <br> %s <br> %s </h1> """ % ( adduser, unregister, remove_f_group) html += "<h3><a href=/>Click to continue</a></h3></div></body></html>" return html