Add separate property for social network registration
This commit is contained in:
@ -143,6 +143,11 @@ List of urls that does not require explicit data processing consent to be access
|
|||||||
Setting this attribute allows the registration process. If you set it to `false`, the module won't allow users to
|
Setting this attribute allows the registration process. If you set it to `false`, the module won't allow users to
|
||||||
register by throwing a `NotFoundHttpException` if the `RegistrationController::actionRegister()` is accessed.
|
register by throwing a `NotFoundHttpException` if the `RegistrationController::actionRegister()` is accessed.
|
||||||
|
|
||||||
|
#### enableSocialNetworkRegistration (type: `boolean`, default: `true`)
|
||||||
|
|
||||||
|
Setting this attribute allows the registration process via social networks. If you set it to `false`, the module won't allow users to
|
||||||
|
register.
|
||||||
|
|
||||||
#### enableEmailConfirmation (type: `boolean`, default: `true`)
|
#### enableEmailConfirmation (type: `boolean`, default: `true`)
|
||||||
|
|
||||||
If `true`, the module will send an email with a confirmation link that user needs to click through to complete its
|
If `true`, the module will send an email with a confirmation link that user needs to click through to complete its
|
||||||
|
|||||||
@ -117,6 +117,10 @@ class Module extends BaseModule
|
|||||||
* @var bool whether to allow registration process or not
|
* @var bool whether to allow registration process or not
|
||||||
*/
|
*/
|
||||||
public $enableRegistration = true;
|
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
|
* @var bool whether to force email confirmation to
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class SocialNetworkAuthenticateService implements ServiceInterface
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$account = $this->socialNetworkAccountQuery->whereClient($this->client)->one();
|
$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'));
|
Yii::$app->session->setFlash('danger', Yii::t('usuario', 'Registration on this website is disabled'));
|
||||||
$this->authAction->setSuccessUrl(Url::to(['/user/security/login']));
|
$this->authAction->setSuccessUrl(Url::to(['/user/security/login']));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user