Commit f7dcdf81 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Convert expiry date when reloading user object (bug #907919)

Commit 725ba929

 tries to reload
certain admin-settable fields from the database into a LiveUser when
committing, but fails to convert the expiry date to a timestamp when
doing so.  This causes logins to fail for users who have an expiry
date set in the future.

Change-Id: I53e962a0f5bab56ab130e1945b251f70447e9411
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 0ce1d338
......@@ -1231,11 +1231,18 @@ class LiveUser extends User {
// Fields which can't be changed in the session, but which may have
// changed in the db. They should be reloaded.
$reload = array(
'active', 'deleted', 'expiry', 'expirymailsent', 'inactivemailsent',
'suspendedctime', 'suspendedreason', 'suspendedcusr', 'quota',
'active' => 'active',
'deleted' => 'deleted',
'expiry' => db_format_tsfield('expiry'),
'expirymailsent' => 'expirymailsent',
'inactivemailsent' => 'inactivemailsent',
'suspendedctime' => 'suspendedctime',
'suspendedreason' => 'suspendedreason',
'suspendedcusr' => 'suspendedcusr',
'quota' => 'quota',
);
$r = get_record('usr', 'id', $this->id);
foreach ($reload as $k) {
$r = get_record('usr', 'id', $this->id, null, null, null, null, join(',', $reload));
foreach (array_keys($reload) as $k) {
if ($r->$k != $this->$k) {
$this->$k = $r->$k;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment