Skip to content

Commit

Permalink
[make:registration-form] render the raw signedUrl in the email templa…
Browse files Browse the repository at this point in the history
…te (#1217)
  • Loading branch information
jrushlow authored Oct 4, 2022
1 parent 14de6f8 commit 32b6011
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Resources/skeleton/registration/twig_email.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<p>
Please confirm your email address by clicking the following link: <br><br>
<a href="{{ signedUrl }}">Confirm my Email</a>.
<a href="{{ signedUrl|raw }}">Confirm my Email</a>.
This link will expire in {{ expiresAtMessageKey|trans(expiresAtMessageData, 'VerifyEmailBundle') }}.
</p>
Expand Down
4 changes: 2 additions & 2 deletions tests/Maker/MakeRegistrationFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function getTestDetails(): \Generator
'[email protected]', // from email address
'SymfonyCasts', // From Name
'n', // no authenticate after
0, // route number to redirect to
'app_anonymous', // route number to redirect to
]);

$this->assertStringContainsString('Success', $output);
Expand Down Expand Up @@ -174,7 +174,7 @@ public function getTestDetails(): \Generator
'[email protected]', // from email address
'SymfonyCasts', // From Name
'n', // no authenticate after
0, // route number to redirect to
'app_anonymous', // route number to redirect to
]);

$this->assertStringContainsString('Success', $output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public function testRegistrationSuccessful()

$client->submit($form);

$messages = $this->getMailerMessages();
self::assertCount(1, $messages);
self::assertEmailCount(1);

/** @var EntityManager $em */
$em = self::$kernel->getContainer()
Expand All @@ -32,9 +31,12 @@ public function testRegistrationSuccessful()

self::assertFalse(($query->getSingleResult())->isVerified());

$context = $messages[0]->getContext();
$messageBody = self::getMailerMessage()->getHtmlBody();

$client->request('GET', $context['signedUrl']);
// Group "1" contains just the signed url from the email
preg_match('/(http.*)(")/', $messageBody, $signedUrl);

$client->request('GET', $signedUrl[1]);

self::assertTrue(($query->getSingleResult())->isVerified());
}
Expand Down

0 comments on commit 32b6011

Please sign in to comment.