Set login date as UTC

lp bug: https://launchpad.net/bugs/967829 fixed

bzr revid: ian@catalyst.net.nz-20120330011407-ungh1s3vde38ptv2
This commit is contained in:
Ian Beardslee
2012-03-30 14:14:07 +13:00
parent 1517145f3f
commit c3ee23dac9
3 changed files with 13 additions and 7 deletions
+4 -2
View File
@@ -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
+5 -3
View File
@@ -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()
+4 -2
View File
@@ -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()