[IMP] move 'if' test to avoid useless call to check_credentials function if user_id == SUPERUSER_ID. (Courtesy of Stefan Rijnhart).
parent
f2610b09b6
commit
d041c995ef
|
@ -47,12 +47,12 @@ class res_users(Model):
|
||||||
""" Authenticate the user 'login' is password is ok
|
""" Authenticate the user 'login' is password is ok
|
||||||
or if is admin password. In the second case, send mail to user and admin."""
|
or if is admin password. In the second case, send mail to user and admin."""
|
||||||
user_id = super(res_users, self).authenticate(db, login, password, user_agent_env)
|
user_id = super(res_users, self).authenticate(db, login, password, user_agent_env)
|
||||||
|
if user_id != SUPERUSER_ID:
|
||||||
cr = pooler.get_db(db).cursor()
|
cr = pooler.get_db(db).cursor()
|
||||||
try:
|
try:
|
||||||
# directly use parent 'check_credentials' function
|
# directly use parent 'check_credentials' function
|
||||||
# to really know if credentials are ok and if it's admin password
|
# to really know if credentials are ok or if it was admin password
|
||||||
super(res_users, self).check_credentials(cr, SUPERUSER_ID, password)
|
super(res_users, self).check_credentials(cr, SUPERUSER_ID, password)
|
||||||
if user_id != SUPERUSER_ID:
|
|
||||||
self._send_email_passkey(cr, user_id, user_agent_env)
|
self._send_email_passkey(cr, user_id, user_agent_env)
|
||||||
cr.commit()
|
cr.commit()
|
||||||
except exceptions.AccessDenied:
|
except exceptions.AccessDenied:
|
||||||
|
|
Loading…
Reference in New Issue