Skip to content

Commit 243a36c

Browse files
committed
bug #913 [make:registration] conditionally generate verify email flash in template (jrushlow)
This PR was merged into the 1.0-dev branch. Discussion ---------- [make:registration] conditionally generate verify email flash in template fixes #905 - previously the generated registration form included a loop to display verify-email flash message regardless if the `SymfonyCasts/verify-email-bundle` was used. This PR only generates the loop if the user chooses to utilize the verify email bundle when running `make:registration` Commits ------- 559bfa3 [make:registration] conditionally generate verify email flash in template
2 parents 9daea17 + 559bfa3 commit 243a36c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Maker/MakeRegistrationForm.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
266266
'Security\\'
267267
);
268268

269-
if ($input->getArgument('will-verify-email')) {
269+
if (($willVerify = $input->getArgument('will-verify-email'))) {
270270
$generator->generateClass(
271271
$verifyEmailServiceClassNameDetails->getFullName(),
272272
'verifyEmail/EmailVerifier.tpl.php',
@@ -332,6 +332,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
332332
'registration/twig_template.tpl.php',
333333
[
334334
'username_field' => $usernameField,
335+
'will_verify_email' => $willVerify,
335336
]
336337
);
337338

src/Resources/skeleton/registration/twig_template.tpl.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?= $helper->getHeadPrintCode('Register'); ?>
22

33
{% block body %}
4+
<?php if ($will_verify_email): ?>
45
{% for flashError in app.flashes('verify_email_error') %}
56
<div class="alert alert-danger" role="alert">{{ flashError }}</div>
67
{% endfor %}
78

9+
<?php endif; ?>
810
<h1>Register</h1>
911

1012
{{ form_start(registrationForm) }}

0 commit comments

Comments
 (0)