mirror of
https://github.com/humhub/humhub.git
synced 2025-03-21 23:49:55 +01:00
Improved update of last login date (also include autoLogin)
This commit is contained in:
parent
8ea544a7d2
commit
23bc31d6e3
@ -13,6 +13,7 @@ $config = [
|
||||
'class' => 'humhub\modules\user\components\User',
|
||||
'identityClass' => 'humhub\modules\user\models\User',
|
||||
'enableAutoLogin' => true,
|
||||
'authTimeout' => 1400,
|
||||
'loginUrl' => ['/user/auth/login']
|
||||
],
|
||||
'errorHandler' => [
|
||||
|
@ -43,7 +43,7 @@ class Session extends DbSession
|
||||
// http://us.php.net/manual/en/function.session-set-save-handler.php
|
||||
try {
|
||||
$userId = new Expression('NULL');
|
||||
if (!Yii::$app->user->isGuest) {
|
||||
if (!Yii::$app->user->getIsGuest()) {
|
||||
$userId = Yii::$app->user->id;
|
||||
}
|
||||
|
||||
|
@ -126,4 +126,14 @@ class User extends \yii\web\User
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function afterLogin($identity, $cookieBased, $duration)
|
||||
{
|
||||
$identity->updateAttributes(['last_login' => new \yii\db\Expression('NOW()')]);
|
||||
|
||||
parent::afterLogin($identity, $cookieBased, $duration);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -175,7 +175,6 @@ class AuthController extends Controller
|
||||
AuthClientHelpers::updateUser($authClient, $user);
|
||||
|
||||
if (Yii::$app->user->login($user, $duration)) {
|
||||
$user->updateAttributes(['last_login' => new \yii\db\Expression('NOW()')]);
|
||||
Yii::$app->user->setCurrentAuthClient($authClient);
|
||||
$url = Yii::$app->user->returnUrl;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user