MAPG-185 consolidation of email templates

This commit is contained in:
Bence Pőcze 2020-07-05 17:37:02 +02:00
parent 0ba1cda884
commit 8403c21ec0
Signed by: bence
GPG Key ID: AA52B11A3269D1C1
3 changed files with 15 additions and 9 deletions

View File

@ -2,8 +2,9 @@ Hi,
<br><br> <br><br>
You recently requested password reset on {{APP_NAME}} with this email address ({{EMAIL}}). You recently requested password reset on {{APP_NAME}} with this email address ({{EMAIL}}).
To reset the password to your account, please click on the following link:<br> To reset the password to your account, please click on the following link:<br>
<a href="{{RESET_LINK}}" title="Reset password">{{RESET_LINK}}</a><br> <a href="{{RESET_LINK}}" title="Reset password">{{RESET_LINK}}</a>
(This link expires at {{EXPIRES}}.) <br><br>
You can reset your password with this link util {{EXPIRES}}.
<br><br> <br><br>
If you did not requested password reset, no further action is required, your account is not touched. If you did not requested password reset, no further action is required, your account is not touched.
<br><br> <br><br>

View File

@ -1,10 +1,14 @@
Hi, Hi,
<br><br> <br><br>
You recently signed up on {{APP_NAME}} with this email address ({{EMAIL}}). To activate your account, please click on the following link:<br> You recently signed up on {{APP_NAME}} with this email address ({{EMAIL}}).
To activate your account, please click on the following link:<br>
<a href="{{ACTIVATE_LINK}}" title="Account activation">{{ACTIVATE_LINK}}</a> <a href="{{ACTIVATE_LINK}}" title="Account activation">{{ACTIVATE_LINK}}</a>
<br><br> <br><br>
If you did not sign up on {{APP_NAME}} or changed your mind, no further action is required, your email address will be deleted soon.<br> You can activate your account until {{ACTIVATABLE_UNTIL}}.
However if you want to immediately delete it, please click on the following link:<br> If you don't activate your account, your email address will be permanently deleted after this point of time.
<br><br>
If you did not sign up on {{APP_NAME}} or changed your mind, no further action is required.
However if you want to immediately delete your email address, please click on the following link:<br>
<a href="{{CANCEL_LINK}}" title="Sign up cancellation">{{CANCEL_LINK}}</a> <a href="{{CANCEL_LINK}}" title="Sign up cancellation">{{CANCEL_LINK}}</a>
<br><br> <br><br>
Have fun on {{APP_NAME}}! Have fun on {{APP_NAME}}!

View File

@ -328,7 +328,7 @@ class LoginController
\Container::$dbConnection->commit(); \Container::$dbConnection->commit();
$this->sendConfirmationEmail($user->getEmail(), $token); $this->sendConfirmationEmail($user->getEmail(), $token, $user->getCreatedDate());
$this->request->session()->delete('tmp_user_data'); $this->request->session()->delete('tmp_user_data');
@ -551,7 +551,7 @@ class LoginController
return new JsonContent(['success' => true]); return new JsonContent(['success' => true]);
} }
private function sendConfirmationEmail(string $email, string $token): void private function sendConfirmationEmail(string $email, string $token, DateTime $created): void
{ {
$mail = new Mail(); $mail = new Mail();
$mail->addRecipient($email); $mail->addRecipient($email);
@ -562,6 +562,7 @@ class LoginController
\Container::$routeCollection->getRoute('signup.activate')->generateLink(['token' => $token]), \Container::$routeCollection->getRoute('signup.activate')->generateLink(['token' => $token]),
'CANCEL_LINK' => $this->request->getBase() . '/' . 'CANCEL_LINK' => $this->request->getBase() . '/' .
\Container::$routeCollection->getRoute('signup.cancel')->generateLink(['token' => $token]), \Container::$routeCollection->getRoute('signup.cancel')->generateLink(['token' => $token]),
'ACTIVATABLE_UNTIL' => (clone $created)->add(new DateInterval('P1D'))->format('Y-m-d H:i T')
]); ]);
$mail->send(); $mail->send();
} }
@ -578,7 +579,7 @@ class LoginController
$this->pdm->saveToDb($confirmation); $this->pdm->saveToDb($confirmation);
$this->sendConfirmationEmail($user->getEmail(), $confirmation->getToken()); $this->sendConfirmationEmail($user->getEmail(), $confirmation->getToken(), $user->getCreatedDate());
return true; return true;
} }
@ -603,7 +604,7 @@ class LoginController
'EMAIL' => $email, 'EMAIL' => $email,
'RESET_LINK' => $this->request->getBase() . '/' . 'RESET_LINK' => $this->request->getBase() . '/' .
\Container::$routeCollection->getRoute('password-reset')->generateLink(['token' => $token]), \Container::$routeCollection->getRoute('password-reset')->generateLink(['token' => $token]),
'EXPIRES' => $expires->format('Y-m-d H:i:s T') 'EXPIRES' => $expires->format('Y-m-d H:i T')
]); ]);
$mail->send(); $mail->send();
} }