Opened 4 years ago

Closed 3 years ago

#1486183 closed Bugs (fixed)

AUTO timezone isn't set when *autologon* plugins are used (ex: autologon, remember_me)

Reported by: ural Owned by:
Priority: 5 Milestone: 0.4-stable
Component: User Interface Version: git-master
Severity: normal Keywords: auto timezone autologon remember_me
Cc: andrew.chadwick@…

Description

RC 0.3-stable+svn, timezone configured as AUTO for users.
I use *remember_me* plugin, where $argsuser? and $argspass? are set in 'authenticate' hook function.
After auto login timezone is set to UTC instead of OS setting. When timezone is configured explicitly in user settings, it is set correctly.

Analyzing the login logic, I found that timezone at login is controlled via a hidden input field _timezone with default value '_default_'.
program/include/rcube_template.php ~1011:
$input_tzone = new html_hiddenfield(...)

then in program/include/rcmail.php ~537:
if ($_REQUEST_timezone? != '_default_')

$_SESSIONtimezone? = floatval($_REQUEST_timezone?);

When we use autologon, login page is skipped, '_default_' is not passed, and $_SESSIONtimezone? is overridden though it must be passed unchanged for AUTO timezones.

For me, I commented this lines in rcmail.php ~537:
if ($_REQUEST_timezone? != '_default_')
$_SESSIONtimezone? = floatval($_REQUEST_timezone?);

But don't know how fine this solution is for all.

Change History (6)

comment:1 Changed 4 years ago by ural

Oh, formatting:

//if ($_REQUEST['_timezone'] != '_default_') 
// $_SESSION['timezone'] = floatval($_REQUEST['_timezone']);

comment:2 Changed 3 years ago by syzop

Just wanted to add that I was experiencing the same issue here (using an autologon plugin) on 0.3.1, and the suggested workaround fixed it.
Without it, all mails were dated 1 hour back.

comment:3 Changed 3 years ago by achadwick

  • Cc andrew.chadwick@… added

Noticed here under a http_authentication regime.

The workaround above works for me too, though it might not be the ideal solution for users not employing 'authenticate' hook plugins. Could it be made conditional?

Ticket #1486553 addresses another problem posed by 'authenticate' plugins, and contains code for identifying when one of these plugins is in use. Perhaps rework that in a combined patch addressing both these bugs?

comment:4 Changed 3 years ago by alec

I'm not sure, what if we just change

if ($_REQUEST['_timezone'] != '_default_') 

to

if (isset($_REQUEST['_timezone']) && $_REQUEST['_timezone'] != '_default_') 

?

comment:5 Changed 3 years ago by ural

This works for me. Have to wait for current session to expire.

comment:6 Changed 3 years ago by alec

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [b62a0d2d].

Note: See TracTickets for help on using tickets.