Guillaume Bourgeois 9 месяцев назад
Родитель
Сommit
42260f5a94
1 измененных файлов: 17 добавлений и 17 удалений
  1. +17
    -17
      backend/controllers/UserController.php

+ 17
- 17
backend/controllers/UserController.php Просмотреть файл

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

Загрузка…
Отмена
Сохранить