Browse Source

[backend] User : correctif envoi nouveau mot de passe

dev
Guillaume 3 years ago
parent
commit
99f46c2b28
1 changed files with 17 additions and 8 deletions
  1. +17
    -8
      backend/controllers/UserController.php

+ 17
- 8
backend/controllers/UserController.php View File

namespace backend\controllers; namespace backend\controllers;


use common\helpers\GlobalParam; use common\helpers\GlobalParam;
use common\helpers\Mailjet;
use common\models\User; use common\models\User;
use common\models\Producer; use common\models\Producer;
use common\models\Distribution; use common\models\Distribution;
$model->save(); $model->save();


$producer = GlobalParam::getCurrentProducer(); $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é.'); Yii::$app->getSession()->setFlash('success', 'Nouveau mot de passe envoyé.');
} }



Loading…
Cancel
Save