[FIX] Trunk backport: properly record UTC login date, courtesy of Ian Beardslee
lp bug: https://launchpad.net/bugs/967829 fixed bzr revid: odo@openerp.com-20120331015249-9pvyin8x4tlymois
This commit is contained in:
parent
b2f8eb7c19
commit
c541f500a3
|
@ -65,8 +65,10 @@ class res_users(osv.osv):
|
|||
return result
|
||||
else:
|
||||
with utils.cursor(db) as cr:
|
||||
cr.execute('UPDATE res_users SET date=now() WHERE login=%s AND openid_key=%s AND active=%s RETURNING id',
|
||||
(tools.ustr(login), tools.ustr(password), True))
|
||||
cr.execute("""UPDATE res_users
|
||||
SET date=now() AT TIME ZONE 'UTC'
|
||||
WHERE login=%s AND openid_key=%s AND active=%s RETURNING id""",
|
||||
(tools.ustr(login), tools.ustr(password), True))
|
||||
res = cr.fetchone()
|
||||
cr.commit()
|
||||
return res[0] if res else False
|
||||
|
|
|
@ -211,9 +211,11 @@ class users(osv.osv):
|
|||
encrypted_pw = encrypt_md5(password, salt)
|
||||
|
||||
# Check if the encrypted password matches against the one in the db.
|
||||
cr.execute('UPDATE res_users SET date=now() ' \
|
||||
'WHERE id=%s AND password=%s AND active RETURNING id',
|
||||
(int(id), encrypted_pw.encode('utf-8')))
|
||||
cr.execute("""UPDATE res_users
|
||||
SET date=now() AT TIME ZONE 'UTC'
|
||||
WHERE id=%s AND password=%s AND active
|
||||
RETURNING id""",
|
||||
(int(id), encrypted_pw.encode('utf-8')))
|
||||
res = cr.fetchone()
|
||||
cr.commit()
|
||||
|
||||
|
|
|
@ -256,8 +256,10 @@ class users(osv.osv):
|
|||
user_id = ldap_obj.get_or_create_user(
|
||||
cr, SUPERUSER_ID, conf, login, entry)
|
||||
if user_id:
|
||||
cr.execute('UPDATE res_users SET date=now() WHERE '
|
||||
'login=%s', (tools.ustr(login),))
|
||||
cr.execute("""UPDATE res_users
|
||||
SET date=now() AT TIME ZONE 'UTC'
|
||||
WHERE login=%s""",
|
||||
(tools.ustr(login),))
|
||||
cr.commit()
|
||||
break
|
||||
cr.close()
|
||||
|
|
Loading…
Reference in New Issue