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\Model\Data\ActivityLog,
|
||||
App\Model\Data\PasswordLink,
|
||||
App\Model\Data\User,
|
||||
SendGrid\Mail\Mail as SendGridMail;
|
||||
App\Model\Data\User;
|
||||
|
||||
class UserController extends ControllerBase
|
||||
{
|
||||
|
|
@ -45,19 +44,15 @@ class UserController extends ControllerBase
|
|||
->setPassword($hash)
|
||||
->save();
|
||||
|
||||
// Render the email content.
|
||||
$tpl = $this->di->get('template');
|
||||
$body = $tpl->render('mail/password_activation', [
|
||||
$content = $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);
|
||||
// Send the email.
|
||||
$this->di->getMail()->send('Httpcb password activation',
|
||||
$user->getEmail(), $content);
|
||||
|
||||
$msg = "For security reasons. Before a password can be created "
|
||||
. "a email has been sent to <strong>{$user->getEmail()}</strong> with "
|
||||
|
|
|
|||
Reference in a new issue