Add separate property for social network registration

This commit is contained in:
Elias Luhr
2024-01-05 15:05:26 +01:00
parent a7e044febf
commit edfbc44c52
3 changed files with 10 additions and 1 deletions

View File

@ -117,6 +117,10 @@ class Module extends BaseModule
* @var bool whether to allow registration process or not
*/
public $enableRegistration = true;
/**
* @var bool whether to allow registration process for social network or not
*/
public $enableSocialNetworkRegistration = true;
/**
* @var bool whether to force email confirmation to
*/

View File

@ -48,7 +48,7 @@ class SocialNetworkAuthenticateService implements ServiceInterface
public function run()
{
$account = $this->socialNetworkAccountQuery->whereClient($this->client)->one();
if (!$this->controller->module->enableRegistration && ($account === null || $account->user === null)) {
if (!$this->controller->module->enableSocialNetworkRegistration && ($account === null || $account->user === null)) {
Yii::$app->session->setFlash('danger', Yii::t('usuario', 'Registration on this website is disabled'));
$this->authAction->setSuccessUrl(Url::to(['/user/security/login']));