From c3ee23dac99acb18925f845beff4f15dc34e29c0 Mon Sep 17 00:00:00 2001 From: Ian Beardslee Date: Fri, 30 Mar 2012 14:14:07 +1300 Subject: [PATCH] Set login date as UTC lp bug: https://launchpad.net/bugs/967829 fixed bzr revid: ian@catalyst.net.nz-20120330011407-ungh1s3vde38ptv2 --- addons/auth_openid/res_users.py | 6 ++++-- addons/base_crypt/crypt.py | 8 +++++--- addons/users_ldap/users_ldap.py | 6 ++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/addons/auth_openid/res_users.py b/addons/auth_openid/res_users.py index c9b5bfc7b26..3fb8cefcbd4 100644 --- a/addons/auth_openid/res_users.py +++ b/addons/auth_openid/res_users.py @@ -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 diff --git a/addons/base_crypt/crypt.py b/addons/base_crypt/crypt.py index c2fd0a25ef8..9b91f7d3108 100644 --- a/addons/base_crypt/crypt.py +++ b/addons/base_crypt/crypt.py @@ -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() diff --git a/addons/users_ldap/users_ldap.py b/addons/users_ldap/users_ldap.py index 1ad1b2df104..1d0c1e3acb9 100644 --- a/addons/users_ldap/users_ldap.py +++ b/addons/users_ldap/users_ldap.py @@ -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()