skeeks\cms\controllers\AdminProfileController::actionChangePassword PHP Method

actionChangePassword() public method

If update is successful, the browser will be redirected to the 'view' page.
public actionChangePassword ( ) : mixed
return mixed
    public function actionChangePassword()
    {
        $model = $this->model;
        $modelForm = new PasswordChangeForm(['user' => $model]);
        if (\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) {
            $modelForm->load(\Yii::$app->request->post());
            \Yii::$app->response->format = Response::FORMAT_JSON;
            return \skeeks\cms\modules\admin\widgets\ActiveForm::validate($modelForm);
        }
        if ($modelForm->load(\Yii::$app->request->post()) && $modelForm->changePassword()) {
            \Yii::$app->getSession()->setFlash('success', 'Успешно сохранено');
            return $this->redirect(['change-password', 'id' => $model->id]);
        } else {
            if (\Yii::$app->request->isPost) {
                \Yii::$app->getSession()->setFlash('error', 'Не удалось изменить пароль');
            }
            return $this->render('@skeeks/cms/views/admin-user/change-password.php', ['model' => $modelForm]);
            /*return $this->render('_form-change-password', [
                  'model' => $modelForm,
              ]);*/
        }
    }