I am trying to verify that the correct password has been entered into the password input box on my site. The aim is to return true if the password entered matches the password in the SQLite table that corresponds the "usernick" entered in the username input box.
def check_login(db, usernick, password):
"""returns True if password matches stored"""
cursor = db.cursor()
cursor.execute("SELECT password FROM users WHERE nick='%s'" % usernick)
passcheck = cursor.fetchone()
print(usernick)
print(password)
print(passcheck)
if password == passcheck:
return True
else:
return False
I used the print's to see where my code was going wrong. The correct username and passwords are being inputted into the function, but print(passcheck) is outputting: ['48181acd22b3edaebc8a447868a7df7ce629920a']
I now realise that this is because the password is decrypted. How do i decrypt the password?
Aucun commentaire:
Enregistrer un commentaire