Commit 915b7283 authored by Jens Segers's avatar Jens Segers

Merge pull request #751 from hieugroup/patch-1

Fix token expiry issue because of time zone difference
parents cee66ee2 e4485d9a
......@@ -28,9 +28,12 @@ class DatabaseTokenRepository extends BaseDatabaseTokenRepository
// Convert UTCDateTime to a date string.
if ($token['created_at'] instanceof UTCDateTime) {
$date = $token['created_at']->toDateTime();
$date->setTimezone(new \DateTimeZone(date_default_timezone_get()));
$token['created_at'] = $date->format('Y-m-d H:i:s');
} elseif (is_array($token['created_at']) and isset($token['created_at']['date'])) {
$token['created_at'] = $token['created_at']['date'];
$date = new DateTime($token['created_at']['date'], new DateTimeZone(isset($token['created_at']['timezone']) ? $token['created_at']['timezone'] : 'UTC'));
$date->setTimezone(date_default_timezone_get());
$token['created_at'] = $date->format('Y-m-d H:i:s');
}
return parent::tokenExpired($token);
......
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