Description
I lost 2 hours debugging the generated test from the Maker command.
This part:
// Test the link sent in the email is valid
$email = $messages[0]->toString();
preg_match('#(/reset-password/reset/[a-zA-Z0-9]+)#', $email, $resetLink);
...actually truncates the reset link and thus creates a regex where only half of the token is captured in the regex. This is my dd($emailBody)
:
From: =?utf-8?Q?Ceph=C3=A9e?= <ne-pas-repondre@example.com>\r\n
To: dufour.virginie@example.com\r\n
Subject: Votre demande de =?utf-8?Q?r=C3=A9initialisation?= de mot de passe\r\n
MIME-Version: 1.0\r\n
Date: Wed, 12 Feb 2025 23:04:19 +0100\r\n
Message-ID: <c2f74a8979e1ffcff19d9fc457a79252@suf.org>\r\n
Content-Type: multipart/alternative; boundary=22I1bWE0\r\n
\r\n
--22I1bWE0\r\n
Content-Type: text/plain; charset=utf-8\r\n
Content-Transfer-Encoding: quoted-printable\r\n
\r\n
Bonjour !\r\n
\r\n
Pour r=C3=A9initialiser votre mot de passe, veuillez visiter=\r\n
le lien suivant\r\n
\r\n
http://localhost/reset-password/reset/3xdOKluZom9sYOL=\r\n
wfeRvJUZVwkrya9HkzcTJd5zl\r\n
\r\n
Ce lien expirera dans 1 heure.\r\n
\r\n
=C3=\r\n
=80 bient=C3=B4t !\r\n
\r\n
--22I1bWE0\r\n
Content-Type: text/html; charset=utf-8\r\n
Content-Transfer-Encoding: quoted-printable\r\n
\r\n
<h1>Bonjour !</h1>\r\n
\r\n
<p>Pour r=C3=A9initialiser votre mot de passe, veui=\r\n
llez visiter le lien suivant</p>\r\n
\r\n
<a href=3D"http://localhost/reset-pas=\r\n
sword/reset/3xdOKluZom9sYOLwfeRvJUZVwkrya9HkzcTJd5zl">http://localhost/rese=\r\n
t-password/reset/3xdOKluZom9sYOLwfeRvJUZVwkrya9HkzcTJd5zl</a>\r\n
\r\n
<p>Ce li=\r\n
en expirera dans 1 heure.</p>\r\n
\r\n
<p>=C3=80 bient=C3=B4t !</p>\r\n
\r\n
--22I1bWE0--\r\n
The email content should be clearly the html or the text but toString is not reliable.
Metadata
Metadata
Assignees
Labels
No labels