public function actionChangePassword() { $user = $this->findModel(); $model = new ChangePasswordForm($user); if ($model->load(Yii::$app->request->post()) && $model->changePassword()) { return $this->redirect(['index']); } else { return $this->render('changePassword', ['model' => $model]); } }
public function actionChangePassword() { $this->layout = '/main'; $changePasswordModel = new ChangePasswordForm(); $success = false; if ($changePasswordModel->load(Yii::$app->request->post()) && $changePasswordModel->changePassword()) { $success = true; $changePasswordModel = new ChangePasswordForm(); } return $this->render('change-password', ['model' => $changePasswordModel, 'success' => $success]); }
public function actionChangePassword() { try { $model = new ChangePasswordForm(); } catch (Exception $e) { return $this->goHome(); //throw new ForbiddenHttpException($e->getMessage()); } if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->changePassword()) { Yii::$app->getSession()->setFlash('success', 'New password was saved.'); return $this->goHome(); } return $this->render('changePassword', ['model' => $model]); }
public function actionChangePassword() { $model = new ChangePasswordForm(); $model->load(Yii::$app->getRequest()->post()); $result = $model->apply(); Yii::$app->getSession()->setFlash($result[0], $result[1]); // return $this->goBack(); return $this->redirect(['user/setting', '#' => 'password']); }
public function actionChangePassword() { $model = new ChangePasswordForm(); if ($model->load(Yii::$app->request->post()) && $model->change()) { AlertHelper::appendAlert('success', Yii::t('happycode', 'Your password was changed.')); return $this->goBack(); } else { return $this->render('change-password', ['model' => $model]); } }