Fix automatically login user after registration (#6294)

* Fix automatically login user after registration

* Update RegistrationController.php

---------

Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
This commit is contained in:
Yuriy Bakhtin 2023-05-05 19:32:03 +04:00 committed by GitHub
parent 8861a580c4
commit a0408aa38f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -12,6 +12,7 @@ HumHub Changelog
- Enh #6242: Submit button hidden when editing a comment having a long "code" line
- Fix #6282: Hard delete content records on integrity check
- Fix #6257: Fix error after publishing of a draft content
- Fix #6273: Fix automatically login user after registration
- Fix #6292: Messages: Notification Indicator Problem
- Fix #6296: Update style variable `background-color-secondary`

View File

@ -89,8 +89,8 @@ class RegistrationController extends Controller
// Autologin when user is enabled (no approval required)
if ($registration->getUser()->status === User::STATUS_ENABLED) {
Yii::$app->user->switchIdentity($registration->models['User']);
$registration->models['User']->updateAttributes(['last_login' => date('Y-m-d G:i:s')]);
$registration->getUser()->refresh(); // https://github.com/humhub/humhub/issues/6273
Yii::$app->user->login($registration->getUser());
if (Yii::$app->request->getIsAjax()) {
return $this->htmlRedirect(Yii::$app->user->returnUrl);
}