Archived
1
0
Fork 0

app/controllers/UserController.php: in settingsAction() send the activation email :)

This commit is contained in:
Henrik Hautakoski 2018-06-12 23:51:04 +02:00
parent 9432f189aa
commit a2abf940b5

View file

@ -5,7 +5,8 @@ namespace App\Controller;
use App\Controller\ControllerBase,
App\Form\UserSettings as UserSettingsForm,
App\Model\Data\ActivityLog,
App\Model\Data\PasswordLink;
App\Model\Data\PasswordLink,
SendGrid\Mail\Mail as SendGridMail;
class UserController extends ControllerBase
{
@ -36,7 +37,19 @@ class UserController extends ControllerBase
->setPassword($hash)
->save();
// TODO: Send the email here.
$tpl = $this->di->get('template');
$body = $tpl->render('mail/password_activation', [
'link' => $link->getPublicId()
]);
$mail = new SendGridMail();
$mail->setFrom('noreply@shufflingpixels.com');
$mail->setSubject('Httpcb password activation');
$mail->addTo($user->getEmail());
$mail->addContent('text/html', $body);
$sendgrid = $this->di->get('sendgrid');
$sendgrid->send($mail);
$msg = "For security reasons. Before a password can be created "
. "a email has been sent to <strong>{$user->getEmail()}</strong> with "