src/ZfcUser/Controller/UserController.php
public function changepasswordAction()
    {
        // if the user isn't logged in, we can't change password
        if (!$this->zfcUserAuthentication()->hasIdentity()) {
            // redirect to the login redirect route
            return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute());
        }

        $form = $this->getChangePasswordForm();
        $prg = $this->prg(static::ROUTE_CHANGEPASSWD);

        $fm = $this->flashMessenger()->setNamespace('change-password')->getMessages();
        if (isset($fm[0])) {
            $status = $fm[0];
        } else {
            $status = null;
        }

        if ($prg instanceof Response) {
            return $prg;
        } elseif ($prg === false) {
            return array(
                'status' => $status,
                'changePasswordForm' => $form,
            );
        }

        $form->setData($prg);

        if (!$form->isValid()) {
            return array(
                'status' => false,
                'changePasswordForm' => $form,
            );
        }

        if (!$this->getUserService()->changePassword($form->getData())) {
            return array(
                'status' => false,
                'changePasswordForm' => $form,
            );
        }

        $this->flashMessenger()->setNamespace('change-password')->addMessage(true);
        return $this->redirect()->toRoute(static::ROUTE_CHANGEPASSWD);
    }
public function changepasswordAction()
    {
        // if the user isn't logged in, we can't change password
        if (!$this->zfcUserAuthentication()->hasIdentity()) {
            // redirect to the login redirect route
            return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute());
        }

        $form = $this->getChangePasswordForm();
        $prg = $this->prg(static::ROUTE_CHANGEPASSWD);

        $fm = $this->flashMessenger()->setNamespace('change-password')->getMessages();
        if (isset($fm[0])) {
            $status = $fm[0];
        } else {
            $status = null;
        }

        if ($prg instanceof Response) {
            return $prg;
        } elseif ($prg === false) {
            return array(
                'status' => $status,
                'changePasswordForm' => $form,
            );
        }

        $form->setData($prg);

        if (!$form->isValid()) {
            return array(
                'status' => false,
                'changePasswordForm' => $form,
            );
        }

        if (!$this->getUserService()->changePassword($form->getData())) {
            return array(
                'status' => false,
                'changePasswordForm' => $form,
            );
        }

        $this->flashMessenger()->setNamespace('change-password')->addMessage(true);
        return $this->redirect()->toRoute(static::ROUTE_CHANGEPASSWD);
    }
public function changepasswordAction ( ) { // if the user isn't logged in, we can't change password if ( ! $ this -> zfcUserAuthentication ( ) -> hasIdentity ( ) ) { // redirect to the login redirect route return $ this -> redirect ( ) -> toRoute ( $ this -> getOptions ( ) -> getLoginRedirectRoute ( ) ) ; } $ form = $ this -> getChangePasswordForm ( ) ; $ prg = $ this -> prg ( static :: ROUTE_CHANGEPASSWD ) ; $ fm = $ this -> flashMessenger ( ) -> setNamespace ( 'change-password' ) -> getMessages ( ) ; if ( isset ( $ fm [ 0 ] ) ) { $ status = $ fm [ 0 ] ; } else { $ status = null ; } if ( $ prg instanceof Response ) { return $ prg ; } elseif ( $ prg === false ) { return array ( 'status' => $ status , 'changePasswordForm' => $ form , ) ; } $ form -> setData ( $ prg ) ; if ( ! $ form -> isValid ( ) ) { return array ( 'status' => false , 'changePasswordForm' => $ form , ) ; } if ( ! $ this -> getUserService ( ) -> changePassword ( $ form -> getData ( ) ) ) { return array ( 'status' => false , 'changePasswordForm' => $ form , ) ; } $ this -> flashMessenger ( ) -> setNamespace ( 'change-password' ) -> addMessage ( true ) ; return $ this -> redirect ( ) -> toRoute ( static :: ROUTE_CHANGEPASSWD ) ; }
Change the users password
Change the users password