openerp-community team mailing list archive
-
openerp-community team
-
Mailing list archive
-
Message #00945
lp:~openerp-community/openobject-addons/ibeardslee_addons_967829 into lp:openobject-addons
Ian Beardslee has proposed merging lp:~openerp-community/openobject-addons/ibeardslee_addons_967829 into lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #967829 in OpenERP Addons: "Login Date Incorrect"
https://bugs.launchpad.net/openobject-addons/+bug/967829
For more details, see:
https://code.launchpad.net/~openerp-community/openobject-addons/ibeardslee_addons_967829/+merge/100089
Changes to ensure that the 3 addon auth methods .. ldap, crypt and openid .. record the login time as UTC rather than the server time.
--
https://code.launchpad.net/~openerp-community/openobject-addons/ibeardslee_addons_967829/+merge/100089
Your team OpenERP Community is subscribed to branch lp:~openerp-community/openobject-addons/ibeardslee_addons_967829.
=== modified file 'auth_openid/res_users.py'
--- auth_openid/res_users.py 2011-12-19 16:54:40 +0000
+++ auth_openid/res_users.py 2012-03-30 09:28:33 +0000
@@ -65,8 +65,10 @@
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
=== modified file 'base_crypt/crypt.py'
--- base_crypt/crypt.py 2011-10-18 09:38:13 +0000
+++ base_crypt/crypt.py 2012-03-30 09:28:33 +0000
@@ -211,9 +211,11 @@
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()
=== modified file 'users_ldap/users_ldap.py'
--- users_ldap/users_ldap.py 2011-11-09 18:12:56 +0000
+++ users_ldap/users_ldap.py 2012-03-30 09:28:33 +0000
@@ -256,8 +256,10 @@
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()
Follow ups