Example #1
0
 public function actionUpdatePassword()
 {
     $model = new UpdatePasswordForm();
     if ($model->load(\Yii::$app->request->post()) && $model->updatePassword()) {
         \Yii::$app->session->setFlash('success', "Пароль успешно изменен");
         return $this->redirect(['user/profile']);
     }
     return $this->render('updatePassword', ['model' => $model]);
 }
Example #2
0
 public function run()
 {
     $user = $this->controller->findModel(Yii::$app->getUser()->id);
     $updatePassword = new UpdatePasswordForm();
     $updateInformation = new UpdateInformationForm();
     $updateInformation->setUserData($user);
     if ($updatePassword->load(Yii::$app->request->post())) {
         $updatePassword->updatePassword($user);
     }
     if ($updateInformation->load(Yii::$app->request->post())) {
         $updateInformation->updateInformation($user);
     }
     return Yii::$app->request->isAjax ? $this->controller->renderAjax('update', ['updatePassword' => $updatePassword, 'updateInformation' => $updateInformation]) : $this->controller->render('update', ['updatePassword' => $updatePassword, 'updateInformation' => $updateInformation]);
 }