Login date recorded in wrong timezone by auth_openid, users_ldap, base_crypt
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Fix Released
|
Low
|
Unassigned |
Bug Description
I noticed that the login date for LDAP users was in the future (I'm in Pacific/Auckland or GMT+13), yet the Administrator user was correct.
It seems that although the addons/
### addons/
cr.execute(
SET date = now() AT TIME ZONE 'UTC'
I found the other places by using "grep -Ri 'update res_users' *"
### addons/
cr.execute('UPDATE res_users SET date=now() WHERE login=%s AND openid_key=%s AND active=%s RETURNING id',
### addons/
cr.execute('UPDATE res_users SET date=now() ' \
'WHERE id=%s AND password=%s AND active RETURNING id',
### addons/
cr.execute(
The 3 "SET date=now()" need to be changed to "SET date=now() AT TIME ZONE 'UTC'" as per addons/
### addons/
cr.execute(
SET date=now() AT TIME ZONE 'UTC'
### addons/
cr.execute(
SET date=now() AT TIME ZONE 'UTC'
### addons/
cr.execute(
SET date=now() AT TIME ZONE 'UTC'
Because I use the users_ldap module, I have only tested changes to that module, and they appear to be correct.
This bug could also be linked to some of the other issues around how dates are updated and retrieved from the database and displayed in the interface and reports.
If, as in addons/
Related branches
- Olivier Dony (Odoo): Approve
-
Diff: 52 lines (+13/-7)3 files modifiedauth_openid/res_users.py (+4/-2)
base_crypt/crypt.py (+5/-3)
users_ldap/users_ldap.py (+4/-2)
affects: | openobject-server → openobject-addons |
Hi Ian,
You're right, these other places where the last login date is updated were not properly patched to use the new UTC server time semantics. Your analysis is correct and the merge proposal looks right too!
Thanks a lot for both!