app/controllers/UserController.php: remove usage of SendGrid and use the mail service.
This commit is contained in:
parent
9d6e17e646
commit
2929c640f0
1 changed files with 6 additions and 11 deletions
|
|
@ -6,8 +6,7 @@ use App\Controller\ControllerBase,
|
||||||
App\Form\UserSettings as UserSettingsForm,
|
App\Form\UserSettings as UserSettingsForm,
|
||||||
App\Model\Data\ActivityLog,
|
App\Model\Data\ActivityLog,
|
||||||
App\Model\Data\PasswordLink,
|
App\Model\Data\PasswordLink,
|
||||||
App\Model\Data\User,
|
App\Model\Data\User;
|
||||||
SendGrid\Mail\Mail as SendGridMail;
|
|
||||||
|
|
||||||
class UserController extends ControllerBase
|
class UserController extends ControllerBase
|
||||||
{
|
{
|
||||||
|
|
@ -45,19 +44,15 @@ class UserController extends ControllerBase
|
||||||
->setPassword($hash)
|
->setPassword($hash)
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
|
// Render the email content.
|
||||||
$tpl = $this->di->get('template');
|
$tpl = $this->di->get('template');
|
||||||
$body = $tpl->render('mail/password_activation', [
|
$content = $tpl->render('mail/password_activation', [
|
||||||
'link' => $link->getPublicId()
|
'link' => $link->getPublicId()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$mail = new SendGridMail();
|
// Send the email.
|
||||||
$mail->setFrom('noreply@shufflingpixels.com');
|
$this->di->getMail()->send('Httpcb password activation',
|
||||||
$mail->setSubject('Httpcb password activation');
|
$user->getEmail(), $content);
|
||||||
$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 "
|
$msg = "For security reasons. Before a password can be created "
|
||||||
. "a email has been sent to <strong>{$user->getEmail()}</strong> with "
|
. "a email has been sent to <strong>{$user->getEmail()}</strong> with "
|
||||||
|
|
|
||||||
Reference in a new issue