Parcourir la source

Merge branch 'dev'

prodstable
Guillaume il y a 3 ans
Parent
révision
8f57ea44f3
1 fichiers modifiés avec 17 ajouts et 8 suppressions
  1. +17
    -8
      backend/controllers/UserController.php

+ 17
- 8
backend/controllers/UserController.php Voir le fichier

@@ -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é.');
}


Chargement…
Annuler
Enregistrer