diff --git a/src/User/Controller/RegistrationController.php b/src/User/Controller/RegistrationController.php index 2834f9d..8c97bce 100644 --- a/src/User/Controller/RegistrationController.php +++ b/src/User/Controller/RegistrationController.php @@ -106,13 +106,17 @@ class RegistrationController extends Controller $mailService = MailFactory::makeWelcomeMailerService($user); if ($this->make(UserRegisterService::class, [$user, $mailService])->run()) { - Yii::$app->session->setFlash( - 'info', - Yii::t( - 'usuario', - 'Your account has been created and a message with further instructions has been sent to your email' - ) - ); + if ($this->module->enableEmailConfirmation) { + Yii::$app->session->setFlash( + 'info', + Yii::t( + 'usuario', + 'Your account has been created and a message with further instructions has been sent to your email' + ) + ); + } else { + Yii::$app->session->setFlash('info', Yii::t('usuario', 'Your account has been created')); + } $this->trigger(FormEvent::EVENT_AFTER_REGISTER, $event); return $this->render( '/shared/message', diff --git a/tests/functional/RegistrationCest.php b/tests/functional/RegistrationCest.php index d496dbe..dfc19cf 100644 --- a/tests/functional/RegistrationCest.php +++ b/tests/functional/RegistrationCest.php @@ -50,7 +50,7 @@ class RegistrationCest $I->see(Html::encode('This email address has already been taken')); $this->register($I, 'tester@example.com', 'tester', 'tester'); - $I->see('Your account has been created and a message with further instructions has been sent to your email'); + $I->see('Your account has been created'); $user = $I->grabRecord(User::className(), ['email' => 'tester@example.com']); $I->assertTrue($user->isConfirmed); @@ -96,7 +96,7 @@ class RegistrationCest ]); $I->amOnRoute('/user/registration/register'); $this->register($I, 'tester@example.com', 'tester'); - $I->see('Your account has been created and a message with further instructions has been sent to your email'); + $I->see('Your account has been created'); $user = $I->grabRecord(User::className(), ['email' => 'tester@example.com']); $I->assertEquals('tester', $user->username); /** @var yii\swiftmailer\Message $message */