Update password.py

This commit is contained in:
Rushabh Mehta 2018-04-16 15:00:21 +05:30 committed by GitHub
parent 52aed5e592
commit b42e8f1210
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,10 +59,8 @@ def check_password(user, pwd, doctype='User', fieldname='password'):
'''Checks if user and password are correct, else raises frappe.AuthenticationError'''
auth = frappe.db.sql("""select name, `password` from `__Auth`
where doctype=%(doctype)s and name=%(name)s and fieldname=%(fieldname)s and encrypted=0""",
{'doctype': doctype, 'name': user, 'fieldname': fieldname},
as_dict=True
)
where doctype=%(doctype)s and name=%(name)s and fieldname=%(fieldname)s and encrypted=0""",
{'doctype': doctype, 'name': user, 'fieldname': fieldname}, as_dict=True)
if not auth or not passlibctx.verify(pwd, auth[0].password):
raise frappe.AuthenticationError(_('Incorrect User or Password'))