|
|
@@ -171,10 +171,26 @@ class UserController extends BackendController |
|
|
|
|
|
|
|
public function actionView($id) |
|
|
|
{ |
|
|
|
$orderModule = $this->getOrderModule(); |
|
|
|
$userModule = $this->getUserModule(); |
|
|
|
$pointSaleModule = $this->getPointSaleModule(); |
|
|
|
$model = $this->findModel($id); |
|
|
|
|
|
|
|
// Email de bienvenue |
|
|
|
$mailWelcome = Yii::$app->request->post('submit_mail_welcome'); |
|
|
|
if ($mailWelcome) { |
|
|
|
$this->getUserModule()->getManager()->welcome($model); |
|
|
|
$this->setFlash('success', 'Email de bienvenue envoyé à <strong>' . Html::encode($userModule->getSolver()->getUsername($model)) . '</strong>.'); |
|
|
|
return $this->redirect(['view', 'id' => $model->id]); |
|
|
|
} |
|
|
|
|
|
|
|
// Mot de passe oublié |
|
|
|
$newPassword = Yii::$app->request->post('submit_new_password'); |
|
|
|
if ($newPassword) { |
|
|
|
$this->getUserModule()->getManager()->newPassword($model); |
|
|
|
$this->setFlash('success', 'Nouveau mot de passe envoyé à <strong>' . Html::encode($userModule->getSolver()->getUsername($model)) . '</strong>.'); |
|
|
|
return $this->redirect(['view', 'id' => $model->id]); |
|
|
|
} |
|
|
|
|
|
|
|
return $this->render('view', [ |
|
|
|
'model' => $model, |
|
|
|
'pointSaleBillingArray' => $pointSaleModule->findByBillingUser($model) |
|
|
@@ -213,22 +229,6 @@ class UserController extends BackendController |
|
|
|
$this->setFlash('success', 'Utilisateur <strong>' . Html::encode($userModule->getUsername($model)) . '</strong> modifié.'); |
|
|
|
return $this->redirect(['view', 'id' => $model->id]); |
|
|
|
} |
|
|
|
|
|
|
|
// Email de bienvenue |
|
|
|
$mailWelcome = Yii::$app->request->post('submit_mail_welcome'); |
|
|
|
if ($mailWelcome) { |
|
|
|
$this->getUserModule()->getManager()->welcome($model); |
|
|
|
$this->setFlash('success', 'Email de bienvenue envoyé à <strong>' . Html::encode($userModule->getSolver()->getUsername($model)) . '</strong>.'); |
|
|
|
return $this->redirect(['view', 'id' => $model->id]); |
|
|
|
} |
|
|
|
|
|
|
|
// Mot de passe oublié |
|
|
|
$newPassword = Yii::$app->request->post('submit_new_password'); |
|
|
|
if ($newPassword) { |
|
|
|
$this->getUserModule()->getManager()->newPassword($model); |
|
|
|
$this->setFlash('success', 'Nouveau mot de passe envoyé à <strong>' . Html::encode($userModule->getSolver()->getUsername($model)) . '</strong>.'); |
|
|
|
return $this->redirect(['view', 'id' => $model->id]); |
|
|
|
} |
|
|
|
} else { |
|
|
|
throw new UserException("Vous ne pouvez pas modifier cet utilisateur."); |
|
|
|
} |