contao/core — Issue #3658: Last login date for frontend user doesn't work as expected
Author: DyaGa
Created: 2011-11-30 13:52:23+00:00
State: open

According to authentication logic in **FrontendUser.php** file (see [authenticate method](https://github.com/contao/core/blob/master/system/modules/frontend/FrontendUser.php#L184) ) User model **$this->lastLogin** value updates only in case when **$this->Input->cookie('FE_AUTO_LOGIN')** exists.

And **FE_AUTO_LOGIN** cookie value exists in case when user selects *Remember me* checkbox value in login form before authentication in Frontend. So, if user doesn't select *Remember me* checkbox in login form the system will not update (save) **lastLogin** value for this user. And here is a problem, because user authenticate in system frontend and system doesn't update **lastLogin** value.

As a solution to the problem, replace code from [Line 187](https://github.com/contao/core/blob/master/system/modules/frontend/FrontendUser.php#L187) to [Line 190](https://github.com/contao/core/blob/master/system/modules/frontend/FrontendUser.php#L190) with next one:

```php
if (parent::authenticate())
{
// Last login date
$this->lastLogin = $this->currentLogin;
$this->currentLogin = time();
$this->save();

return true;
}
```