diff --git a/lib/Controller/RegisterController.php b/lib/Controller/RegisterController.php index 33954bc..ed6a83c 100644 --- a/lib/Controller/RegisterController.php +++ b/lib/Controller/RegisterController.php @@ -99,7 +99,8 @@ class RegisterController extends Controller { $params = [ 'email' => $email, 'message' => $message ?: $emailHint, - 'disable_email_verification' => $this->config->getAppValue($this->appName, 'disable_email_verification', 'no') + 'disable_email_verification' => $this->config->getAppValue($this->appName, 'disable_email_verification', 'no'), + 'is_login_flow' => $this->loginFlowService->isUsingLoginFlow(), ]; return new TemplateResponse('registration', 'form/email', $params, 'guest'); } diff --git a/lib/Service/MailService.php b/lib/Service/MailService.php index c90cbf3..6ed3386 100644 --- a/lib/Service/MailService.php +++ b/lib/Service/MailService.php @@ -50,6 +50,8 @@ class MailService { private $l10n; /** @var IGroupManager */ private $groupManager; + /** @var LoginFlowService */ + private $loginFlowService; /** @var ILogger */ private $logger; /** @var IConfig */ @@ -61,6 +63,7 @@ class MailService { IL10N $l10n, IGroupManager $groupManager, IConfig $config, + LoginFlowService $loginFlowService, ILogger $logger) { $this->urlGenerator = $urlGenerator; $this->mailer = $mailer; @@ -68,6 +71,7 @@ class MailService { $this->defaults = $defaults; $this->l10n = $l10n; $this->groupManager = $groupManager; + $this->loginFlowService = $loginFlowService; $this->logger = $logger; } @@ -103,11 +107,17 @@ class MailService { $template->addHeading($this->l10n->t('Registration')); $body = $this->l10n->t('Email address verified, you can now complete your registration.'); - $template->addBodyText( - htmlspecialchars($body . ' ' . $this->l10n->t('Click the button below to continue.')), - $body - ); - + if (!$this->loginFlowService->isUsingLoginFlow()) { + $template->addBodyText( + htmlspecialchars($body . ' ' . $this->l10n->t('Click the button below to continue.')), + $body + ); + } else { + $template->addBodyText( + $body + ); + } + // if the parameter is set through the settings panel add to body text $email_verification_hint = $this->config->getAppValue('registration', 'email_verification_hint'); if (!empty($email_verification_hint)) { @@ -118,10 +128,12 @@ class MailService { $this->l10n->t('Verification code: %s', $registration->getToken()) ); - $template->addBodyButton( - $this->l10n->t('Continue registration'), - $link - ); + if (!$this->loginFlowService->isUsingLoginFlow()) { + $template->addBodyButton( + $this->l10n->t('Continue registration'), + $link + ); + } $template->addFooter(); $from = Util::getDefaultEmailAddress('register'); diff --git a/templates/form/email.php b/templates/form/email.php index 01e2c56..855155b 100644 --- a/templates/form/email.php +++ b/templates/form/email.php @@ -20,9 +20,11 @@ style('registration', 'style'); + } ?>" /> t('Back to login')); ?> diff --git a/tests/Unit/Controller/RegisterControllerTest.php b/tests/Unit/Controller/RegisterControllerTest.php index 5c8ce8d..b9036e5 100644 --- a/tests/Unit/Controller/RegisterControllerTest.php +++ b/tests/Unit/Controller/RegisterControllerTest.php @@ -127,6 +127,9 @@ class RegisterControllerTest extends TestCase { $response = $controller->showEmailForm($email, $message); $disable_email_verification = $this->config->getAppValue('registration', 'disable_email_verification', 'no'); + $this->loginFlowService->method('isUsingLoginFlow') + ->willReturn(false); + self::assertSame(TemplateResponse::RENDER_AS_GUEST, $response->getRenderAs()); self::assertSame('form/email', $response->getTemplateName()); @@ -134,6 +137,7 @@ class RegisterControllerTest extends TestCase { 'email' => $email, 'message' => $message, 'disable_email_verification' => $disable_email_verification, + 'is_login_flow' => false, ], $response->getParams()); }