From 9d935d84cdc021bc23bea0301b2ad04bbe2698bd Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Tue, 13 Sep 2016 14:50:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=BD=D1=82=D0=B5=D0=B3=D1=80=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D0=BF=D0=B8=D1=81=D1=8C=D0=BC=D0=B0=20?= =?UTF-8?q?=D0=BE=20=D1=80=D0=B5=D0=B3=D0=B8=D1=81=D1=82=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/models/authentication/RegistrationForm.php | 16 +++++++++++----- composer.json | 7 ++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/api/models/authentication/RegistrationForm.php b/api/models/authentication/RegistrationForm.php index 2f0f185..8122c4d 100644 --- a/api/models/authentication/RegistrationForm.php +++ b/api/models/authentication/RegistrationForm.php @@ -11,6 +11,7 @@ use common\models\confirmations\RegistrationConfirmation; use common\models\EmailActivation; use common\validators\LanguageValidator; use common\validators\PasswordValidate; +use Ely\Email\Renderer; use Exception; use Ramsey\Uuid\Uuid; use Yii; @@ -131,13 +132,18 @@ class RegistrationForm extends ApiForm { throw new InvalidConfigException('Please specify fromEmail app in app params'); } - /** @var \yii\swiftmailer\Message $message */ - $message = $mailer->compose([ - 'html' => '@app/mails/registration-confirmation-html', - 'text' => '@app/mails/registration-confirmation-text', - ], [ + $htmlBody = (new Renderer())->getTemplate('register') + ->setLocale($account->lang) + ->setParams([ + 'username' => $account->username, '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]) ->setFrom([$fromEmail => 'Ely.by Accounts']) ->setSubject('Ely.by Account registration'); diff --git a/composer.json b/composer.json index 44505b1..e3f4eed 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,8 @@ "php-amqplib/php-amqplib": "^2.6.2", "ely/yii2-tempmail-validator": "~1.0.0", "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": { "yiisoft/yii2-codeception": "*", @@ -48,6 +49,10 @@ { "type": "git", "url": "git@gitlab.com:elyby/amqp-controller.git" + }, + { + "type": "git", + "url": "git@gitlab.com:elyby/email-renderer.git" } ], "scripts": {