diff --git a/api/models/authentication/ForgotPasswordForm.php b/api/models/authentication/ForgotPasswordForm.php index 61dfe5e..e69adf1 100644 --- a/api/models/authentication/ForgotPasswordForm.php +++ b/api/models/authentication/ForgotPasswordForm.php @@ -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'); diff --git a/composer.json b/composer.json index 1d7c064..71c60db 100644 --- a/composer.json +++ b/composer.json @@ -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": "*",