Add localisation to password reset email

This commit is contained in:
grandeljay 2022-06-12 10:30:29 +02:00
parent 5ff74d05ee
commit 47876dbbbd
2 changed files with 19 additions and 4 deletions

View file

@ -44,11 +44,11 @@
<mj-section mj-class="segment" css-class="segment"> <mj-section mj-class="segment" css-class="segment">
<mj-column> <mj-column>
<mj-text>Hello,</mj-text> <mj-text>TEXT_HELLO</mj-text>
<mj-text>somebody has requested a password reset for this email address from <a href="https://wishthis.online">wishthis.online</a>. If this was you, click the button below to invalidate your current password and set a new one.</mj-text> <mj-text>TEXT_PASSWORD_RESET</mj-text>
<mj-button href="password-reset-link">Set new password</mj-button> <mj-button href="password-reset-link">TEXT_SET_NEW_PASSWORD</mj-button>
</mj-column> </mj-column>
</mj-section> </mj-section>

View file

@ -60,11 +60,26 @@ if (isset($_POST['reset'], $_POST['email'])) {
$database $database
->query('UPDATE `users` ->query('UPDATE `users`
SET `password_reset_token` = "' . $token . '", SET `password_reset_token` = "' . $token . '",
`password_reset_valid_until` = ' . $validUntil . ' `password_reset_valid_until` = "' . date('Y-m-d H:i:s', $validUntil) . '"
WHERE `id` = ' . $user['id'] . ' WHERE `id` = ' . $user['id'] . '
;'); ;');
$mjml = file_get_contents(ROOT . '/src/mjml/password-reset.mjml'); $mjml = file_get_contents(ROOT . '/src/mjml/password-reset.mjml');
$mjml = str_replace(
'TEXT_HELLO',
__('Hello,'),
$mjml
);
$mjml = str_replace(
'TEXT_PASSWORD_RESET',
__('somebody has requested a password reset for this email address from <a href="https://wishthis.online">wishthis.online</a>. If this was you, click the button below to invalidate your current password and set a new one.'),
$mjml
);
$mjml = str_replace(
'TEXT_SET_NEW_PASSWORD',
__('Set new password'),
$mjml
);
$mjml = str_replace( $mjml = str_replace(
'wishthis.online', 'wishthis.online',
$_SERVER['HTTP_HOST'], $_SERVER['HTTP_HOST'],