Ver código fonte

Adaptations refactoring/traduction frontend/controllers/UserController

dev
Guillaume Bourgeois 6 anos atrás
pai
commit
29dc137f66
1 arquivos alterados com 5 adições e 8 exclusões
  1. +5
    -8
      frontend/controllers/UserController.php

+ 5
- 8
frontend/controllers/UserController.php Ver arquivo

@@ -67,9 +67,6 @@ class UserController extends FrontendController
[
'allow' => true,
'roles' => ['@'],
/* 'matchCallback' => function ($rule, $action) {
return Yii::$app->user->identity->status == USER::STATUS_ADMIN ;
} */
]
],
],
@@ -84,13 +81,13 @@ class UserController extends FrontendController
*/
public function actionUpdate()
{
$model = $this->findModel(Yii::$app->user->identity->id);
$model = $this->findModel(User::getId());

if ($model->load(Yii::$app->request->post()) && $model->validate()) {

// l'utilisateur ne peut pas changer d'adresse email
$old_model = $this->findModel(Yii::$app->user->identity->id);
$model->email = $old_model->email;
$oldModel = $this->findModel(User::getId());
$model->email = $oldModel->email;

// modification du mot de passe
if (strlen($model->password_new)) {
@@ -107,7 +104,7 @@ class UserController extends FrontendController
Yii::$app->session->setFlash('success', 'Votre profil a bien été modifié.');

return $this->render('update', [
'model' => $model,
'model' => $model,
]);
} else {

@@ -116,7 +113,7 @@ class UserController extends FrontendController
}

return $this->render('update', [
'model' => $model,
'model' => $model,
]);
}
}

Carregando…
Cancelar
Salvar