Fixed last login time

This commit is contained in:
Marcin Kurczewski 2014-05-18 20:52:35 +02:00
parent 9f57b16d76
commit c50c368d2f
3 changed files with 8 additions and 2 deletions

View file

@ -37,6 +37,9 @@ class Auth
}
self::setCurrentUser($user);
$user->setLastLoginTime(time());
UserModel::save($user);
}
public static function tryAutoLogin()

View file

@ -35,8 +35,8 @@ final class UserEntity extends AbstractEntity implements IValidatable, ISerializ
$this->staffConfirmed = $row['staff_confirmed'];
$this->emailUnconfirmed = $row['email_unconfirmed'];
$this->emailConfirmed = $row['email_confirmed'];
$this->joinDate = $row['join_date'];
$this->lastLoginDate = $row['last_login_date'];
$this->joinDate = TextHelper::toIntegerOrNull($row['join_date']);
$this->lastLoginDate = TextHelper::toIntegerOrNull($row['last_login_date']);
$this->banned = $row['banned'];
$this->setAccessRank(new AccessRank($row['access_rank']));
$this->settings = new UserSettings($row['settings']);

View file

@ -15,6 +15,9 @@ class AuthTest extends AbstractTest
});
$this->assert->isTrue(Auth::isLoggedIn());
$user = UserModel::getByName($user->getName());
$this->assert->areEqual(time(), $user->getLastLoginTime());
}
public function testLoginViaEmail()