/** * Displays the password reset page */ public function actionPassword() { if (Pii::guest()) { $this->_redirectError('You must be logged in to change your password.'); } $_model = new PasswordForm(); // collect user input data if (isset($_POST, $_POST['PasswordForm'])) { $_model->attributes = $_POST['PasswordForm']; // Validate user input and redirect to the previous page if valid if ($_model->validate()) { try { $_userId = Session::getCurrentUserId(); $_result = Password::changePassword($_userId, $_model->old_password, $_model->new_password); if (Option::getBool($_result, 'success')) { Yii::app()->user->setFlash('password-form', 'Your password has been successfully updated.'); } } catch (\Exception $_ex) { $_model->addError(null, $_ex->getMessage()); } } } $this->render('password', array('model' => $_model, 'backUrl' => $this->_getRedirectUrl())); }