src/Mvc/Controller/IndexController.php
public function changePasswordAction()
    {
        // if the user is not logged in, we can't change password
        if (!$this->cmsAuthentication()->hasIdentity()) {
            // redirect to the login redirect route
            return $this->redirect()->toRoute($this->getOptions()->getLoginRoute());
        }

        $url = $this->url()->fromRoute(null, ['action' => 'change-password']);

        $prg = $this->prg($url, true);
        if ($prg instanceof ResponseInterface) {
            return $prg;
        }

        $post = $prg;

        $form = $this->getUserService()->getChangePasswordForm();
        $form->setObject($this->cmsAuthentication()->getIdentity());
        $form->setAttribute('action', $url);

        if ($post && $form->setData($post)->isValid()) {

            $identity = $this->getUserService()->changePassword($post);

            // Return early if an user service returned a response
            if ($identity instanceof ResponseInterface) {
                return $identity;
            } elseif ($identity) { // Password changed successfully
                $viewModel = new ViewModel(compact('identity'));
                $viewModel->setTemplate('cms-user/index/change-password-success');
                return $viewModel;
            }
        }

        return new ViewModel(compact('form'));
    }
public function changePasswordAction()
    {
        // if the user is not logged in, we can't change password
        if (!$this->cmsAuthentication()->hasIdentity()) {
            // redirect to the login redirect route
            return $this->redirect()->toRoute($this->getOptions()->getLoginRoute());
        }

        $url = $this->url()->fromRoute(null, ['action' => 'change-password']);

        $prg = $this->prg($url, true);
        if ($prg instanceof ResponseInterface) {
            return $prg;
        }

        $post = $prg;

        $form = $this->getUserService()->getChangePasswordForm();
        $form->setObject($this->cmsAuthentication()->getIdentity());
        $form->setAttribute('action', $url);

        if ($post && $form->setData($post)->isValid()) {

            $identity = $this->getUserService()->changePassword($post);

            // Return early if an user service returned a response
            if ($identity instanceof ResponseInterface) {
                return $identity;
            } elseif ($identity) { // Password changed successfully
                $viewModel = new ViewModel(compact('identity'));
                $viewModel->setTemplate('cms-user/index/change-password-success');
                return $viewModel;
            }
        }

        return new ViewModel(compact('form'));
    }
Change password action

Displays user change password form

@return ResponseInterface|ViewModel