diff --git a/src/Service/PasswordResetService.php b/src/Service/PasswordResetService.php index 31e40fa..73ff2c2 100644 --- a/src/Service/PasswordResetService.php +++ b/src/Service/PasswordResetService.php @@ -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')); } diff --git a/templates/email/passwordResetToken.php b/templates/email/passwordResetToken.php index f2d12f4..bdb047a 100644 --- a/templates/email/passwordResetToken.php +++ b/templates/email/passwordResetToken.php @@ -1,5 +1,5 @@

Password reset link

-

By clicking the following link you can set new password for :

-

/password/set?token=

+

By clicking the following link you can set new password for {url}:

+

{url}/password/set?token={token}

Regards,
- Admin

\ No newline at end of file + {url} Administrator

\ No newline at end of file