Интегрирован шаблон для письма "забыл пароль"

This commit is contained in:
ErickSkrauch 2016-10-03 01:59:24 +03:00
parent b67a1879fe
commit c162a46e62
2 changed files with 14 additions and 9 deletions

View File

@ -84,15 +84,20 @@ class ForgotPasswordForm extends ApiForm {
throw new InvalidConfigException('Please specify fromEmail app in app params');
}
$acceptor = $emailActivation->account;
$account = $emailActivation->account;
$htmlBody = Yii::$app->emailRenderer->getTemplate('forgotPassword')
->setLocale($account->lang)
->setParams([
'username' => $account->username,
'key' => $emailActivation->key,
'link' => Yii::$app->request->getHostInfo() . '/recover-password/' . $emailActivation->key,
])
->render();
/** @var \yii\swiftmailer\Message $message */
$message = $mailer->compose([
'html' => '@app/mails/forgot-password-html',
'text' => '@app/mails/forgot-password-text',
], [
'key' => $emailActivation->key,
])
->setTo([$acceptor->email => $acceptor->username])
$message = $mailer->compose()
->setHtmlBody($htmlBody)
->setTo([$account->email => $account->username])
->setFrom([$fromEmail => 'Ely.by Accounts'])
->setSubject('Ely.by Account forgot password');

View File

@ -25,7 +25,7 @@
"ely/yii2-tempmail-validator": "~1.0.0",
"emarref/jwt": "~1.0.3",
"ely/amqp-controller": "^0.1.0",
"ely/email-renderer": "dev-master#8c975737c6681af4bbd161ff27fe6326d39ba9d6"
"ely/email-renderer": "dev-master#c70ab0d3b0208bb7d61281a166ec7a9c5344eaad"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",