Интеграция письма о регистрации

This commit is contained in:
ErickSkrauch 2016-09-13 14:50:22 +03:00
parent aeeef828e8
commit 9d935d84cd
2 changed files with 17 additions and 6 deletions

View File

@ -11,6 +11,7 @@ use common\models\confirmations\RegistrationConfirmation;
use common\models\EmailActivation; use common\models\EmailActivation;
use common\validators\LanguageValidator; use common\validators\LanguageValidator;
use common\validators\PasswordValidate; use common\validators\PasswordValidate;
use Ely\Email\Renderer;
use Exception; use Exception;
use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Uuid;
use Yii; use Yii;
@ -131,13 +132,18 @@ class RegistrationForm extends ApiForm {
throw new InvalidConfigException('Please specify fromEmail app in app params'); throw new InvalidConfigException('Please specify fromEmail app in app params');
} }
/** @var \yii\swiftmailer\Message $message */ $htmlBody = (new Renderer())->getTemplate('register')
$message = $mailer->compose([ ->setLocale($account->lang)
'html' => '@app/mails/registration-confirmation-html', ->setParams([
'text' => '@app/mails/registration-confirmation-text', 'username' => $account->username,
], [
'key' => $emailActivation->key, 'key' => $emailActivation->key,
'link' => Yii::$app->request->getHostInfo() . '/activation/' . $emailActivation->key,
]) ])
->render();
/** @var \yii\swiftmailer\Message $message */
$message = $mailer->compose()
->setHtmlBody($htmlBody)
->setTo([$account->email => $account->username]) ->setTo([$account->email => $account->username])
->setFrom([$fromEmail => 'Ely.by Accounts']) ->setFrom([$fromEmail => 'Ely.by Accounts'])
->setSubject('Ely.by Account registration'); ->setSubject('Ely.by Account registration');

View File

@ -24,7 +24,8 @@
"php-amqplib/php-amqplib": "^2.6.2", "php-amqplib/php-amqplib": "^2.6.2",
"ely/yii2-tempmail-validator": "~1.0.0", "ely/yii2-tempmail-validator": "~1.0.0",
"emarref/jwt": "~1.0.3", "emarref/jwt": "~1.0.3",
"ely/amqp-controller": "^0.1.0" "ely/amqp-controller": "^0.1.0",
"ely/email-renderer": "dev-master#10e77d7a60403e87ca6e8c7d9e62a36fc5e08565"
}, },
"require-dev": { "require-dev": {
"yiisoft/yii2-codeception": "*", "yiisoft/yii2-codeception": "*",
@ -48,6 +49,10 @@
{ {
"type": "git", "type": "git",
"url": "git@gitlab.com:elyby/amqp-controller.git" "url": "git@gitlab.com:elyby/amqp-controller.git"
},
{
"type": "git",
"url": "git@gitlab.com:elyby/email-renderer.git"
} }
], ],
"scripts": { "scripts": {