Sfoglia il codice sorgente

[Administration] Vue utilisation : gestion envoi mot de passe et mail de bienvenue

feature/souke
Guillaume Bourgeois 8 mesi fa
parent
commit
12fbe45573
1 ha cambiato i file con 17 aggiunte e 17 eliminazioni
  1. +17
    -17
      backend/controllers/UserController.php

+ 17
- 17
backend/controllers/UserController.php Vedi File

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

Loading…
Annulla
Salva