diff --git a/composer.json b/composer.json index 177eee8..dcebae9 100644 --- a/composer.json +++ b/composer.json @@ -52,6 +52,8 @@ "2amigos/qrcode-library": "Needed if you want to enable 2FA with QR Code generation. Require version ^1.1" }, "require-dev": { + "2amigos/2fa-library": "^2.0", + "2amigos/qrcode-library": "^2.0", "friendsofphp/php-cs-fixer": "^2.3", "squizlabs/php_codesniffer": "*", "phpmd/phpmd": "@stable", diff --git a/src/User/Service/SocialNetworkAuthenticateService.php b/src/User/Service/SocialNetworkAuthenticateService.php index da80f65..ded5f47 100644 --- a/src/User/Service/SocialNetworkAuthenticateService.php +++ b/src/User/Service/SocialNetworkAuthenticateService.php @@ -67,6 +67,7 @@ class SocialNetworkAuthenticateService implements ServiceInterface $event = Yii::createObject(SocialNetworkAuthEvent::class, [$account, $this->client]); $this->controller->trigger(SocialNetworkAuthEvent::EVENT_BEFORE_AUTHENTICATE, $event); + $result = false; if ($account->user instanceof User) { if ($account->user->getIsBlocked()) { @@ -75,12 +76,15 @@ class SocialNetworkAuthenticateService implements ServiceInterface } else { Yii::$app->user->login($account->user, $this->controller->module->rememberLoginLifespan); $this->authAction->setSuccessUrl(Yii::$app->getUser()->getReturnUrl()); + $result = true; } } else { $this->authAction->setSuccessUrl($account->getConnectionUrl()); + $result = true; } $this->controller->trigger(SocialNetworkAuthEvent::EVENT_AFTER_AUTHENTICATE, $event); + return $result; } protected function createAccount() diff --git a/src/User/Service/SwitchIdentityService.php b/src/User/Service/SwitchIdentityService.php index 842197b..4038c33 100644 --- a/src/User/Service/SwitchIdentityService.php +++ b/src/User/Service/SwitchIdentityService.php @@ -65,5 +65,6 @@ class SwitchIdentityService implements ServiceInterface /** @var IdentityInterface $user */ Yii::$app->user->switchIdentity($user, $session->timeout); $this->controller->trigger(UserEvent::EVENT_AFTER_SWITCH_IDENTITY, $event); + return true; } }