瀏覽代碼

Merge branch 'dev'

prodstable
Guillaume 3 年之前
父節點
當前提交
8f57ea44f3
共有 1 個文件被更改,包括 17 次插入8 次删除
  1. +17
    -8
      backend/controllers/UserController.php

+ 17
- 8
backend/controllers/UserController.php 查看文件

@@ -39,6 +39,7 @@
namespace backend\controllers;

use common\helpers\GlobalParam;
use common\helpers\Mailjet;
use common\models\User;
use common\models\Producer;
use common\models\Distribution;
@@ -277,14 +278,22 @@ class UserController extends BackendController
$model->save();

$producer = GlobalParam::getCurrentProducer();
Yii::$app->mailer->compose();
$mail = Yii::$app->mailer->compose(
['html' => 'newPasswordUserAdmin-html', 'text' => 'newPasswordUserAdmin-text'], ['user' => $model, 'producer' => $producer, 'password' => $password]
)
->setTo($model->email)
->setFrom(['contact@opendistrib.net' => 'Opendistrib'])
->setSubject('[Opendistrib] Nouveau mot de passe')
->send();

Mailjet::sendMail([
'from_email' => $producer->getEmailOpendistrib(),
'from_name' => $producer->name,
'to_email' => $model->email,
'to_name' => $model->getUsername(),
'subject' => '['.$producer->name.'] Nouveau mot de passe',
'content_view_text' => '@common/mail/newPasswordUserAdmin-text.php',
'content_view_html' => '@common/mail/newPasswordUserAdmin-html.php',
'content_params' => [
'user' => $user,
'producer' => $producer,
'password' => $password,
]
]);

Yii::$app->getSession()->setFlash('success', 'Nouveau mot de passe envoyé.');
}


Loading…
取消
儲存