Fixes email template used in password reset service

This commit is contained in:
2024-02-08 00:21:14 +01:00
parent 41ef9dd810
commit 981db83a10
2 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -44,12 +44,16 @@ class PasswordResetService {
return false;
}
private function sendResetToken(PasswordResetToken $token, string $email): bool {
private function sendResetToken(PasswordResetTokenInterface $token, string $email): bool {
$url = $_SERVER['HTTP_HOST'];
$body = file_get_contents(__DIR__ . '/../../templates/email/passwordResetToken.php');
if (file_exists(__DIR__ . '/../../../../../' . config('password-reset-mail-template') . '.php')) {
$body = file_get_contents(__DIR__ . '/../../../../../templates/email/passwordResetToken.php');
}
$search = ['{url}', '{token}'];
$replace = [$_SERVER['HTTP_HOST'], $token->getToken()];
$body = str_replace($search, $replace, $body);
return $this->mailer->send(config('password-reset-mail-from'), $email, config('password-reset-mail-subject'), $body, config('password-reset-mail-headers'));
}
+3 -3
View File
@@ -1,5 +1,5 @@
<h2>Password reset link</h2>
<p>By clicking the following link you can set new password for <?php echo $url; ?>:</p>
<p><a href="<?php echo $url; ?>/password/set?token=<?php echo $token; ?>"><?php echo $url; ?>/password/set?token=<?php echo $token; ?></a></p>
<p>By clicking the following link you can set new password for {url}:</p>
<p><a href="{url}/password/set?token={token}">{url}/password/set?token={token}</a></p>
<p>Regards,<br>
<?php echo $url; ?> Admin</p>
{url} Administrator</p>