Don't mention verification link when the login flow is used
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
4430d2b497
commit
afcee9b763
|
|
@ -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');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,10 +107,16 @@ 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');
|
||||
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -20,9 +20,11 @@ style('registration', 'style');
|
|||
<input type="submit" id="submit" value="<?php
|
||||
if ($_['disable_email_verification'] === 'yes') {
|
||||
p($l->t('Continue'));
|
||||
} elseif ($_['is_login_flow']) {
|
||||
p($l->t('Request verification code'));
|
||||
} else {
|
||||
p($l->t('Request verification link'));
|
||||
}?>" />
|
||||
} ?>" />
|
||||
|
||||
<a id="lost-password-back" href="<?php print_unescaped(\OC::$server->getURLGenerator()->linkToRoute('core.login.showLoginForm')) ?>">
|
||||
<?php p($l->t('Back to login')); ?>
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue