|
|
|
|
|
|
|
|
[ |
|
|
[ |
|
|
'allow' => true, |
|
|
'allow' => true, |
|
|
'roles' => ['@'], |
|
|
'roles' => ['@'], |
|
|
/* 'matchCallback' => function ($rule, $action) { |
|
|
|
|
|
return Yii::$app->user->identity->status == USER::STATUS_ADMIN ; |
|
|
|
|
|
} */ |
|
|
|
|
|
] |
|
|
] |
|
|
], |
|
|
], |
|
|
], |
|
|
], |
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
public function actionUpdate() |
|
|
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()) { |
|
|
if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
|
|
|
|
|
|
|
// l'utilisateur ne peut pas changer d'adresse email |
|
|
// 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 |
|
|
// modification du mot de passe |
|
|
if (strlen($model->password_new)) { |
|
|
if (strlen($model->password_new)) { |
|
|
|
|
|
|
|
|
Yii::$app->session->setFlash('success', 'Votre profil a bien été modifié.'); |
|
|
Yii::$app->session->setFlash('success', 'Votre profil a bien été modifié.'); |
|
|
|
|
|
|
|
|
return $this->render('update', [ |
|
|
return $this->render('update', [ |
|
|
'model' => $model, |
|
|
|
|
|
|
|
|
'model' => $model, |
|
|
]); |
|
|
]); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return $this->render('update', [ |
|
|
return $this->render('update', [ |
|
|
'model' => $model, |
|
|
|
|
|
|
|
|
'model' => $model, |
|
|
]); |
|
|
]); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |