From 4928df077017b345dd39bcd935d593cc3acf00bd Mon Sep 17 00:00:00 2001 From: Arthur Khachaturov Date: Fri, 9 Feb 2018 15:41:15 +0300 Subject: [PATCH 1/3] Check enableEmailConfirmation --- src/User/Controller/RegistrationController.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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', From 9e2e261bb8db3c63b05409a6753e938a6680e0f6 Mon Sep 17 00:00:00 2001 From: Arthur Khachaturov Date: Fri, 9 Feb 2018 15:41:46 +0300 Subject: [PATCH 2/3] Fix tests --- tests/functional/RegistrationCest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/RegistrationCest.php b/tests/functional/RegistrationCest.php index d496dbe..bad4abf 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); From 60e5ee2b80de3b9e0ecb1593fb41c8a36d2a1ec8 Mon Sep 17 00:00:00 2001 From: Arthur Khachaturov Date: Wed, 14 Feb 2018 13:01:22 +0300 Subject: [PATCH 3/3] Update RegistrationCest.php --- tests/functional/RegistrationCest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/RegistrationCest.php b/tests/functional/RegistrationCest.php index bad4abf..dfc19cf 100644 --- a/tests/functional/RegistrationCest.php +++ b/tests/functional/RegistrationCest.php @@ -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 */