src/Controller/UserController.php
public function lostPasswordRequestAction() 
    {
        $pathAppConfigForm = '/meliscore/forms/meliscore_forgot';
        $melisMelisCoreConfig = $this->serviceLocator->get('MelisCoreConfig');
        $appConfigForm = $melisMelisCoreConfig->getItem($pathAppConfigForm);
        $translator = $this->getServiceLocator()->get('translator');
        
        $success = false;
        $errors  = array();
        $message = '';

        
        if($this->getRequest()->isPost())
        {
            $login = $this->getRequest()->getPost('usr_login');
            $email = $this->getRequest()->getPost('usr_email');
            
            $melisLostPass = $this->getServiceLocator()->get('MelisCoreLostPassword');
            $userTable = $this->getServiceLocator()->get('MelisCoreTableUser');
            $userData = $userTable->getDataByLoginAndEmail($login, $email);
            $userData = $userData->current();
            
            if($userData) 
            {
                if($melisLostPass->userExists($login))
                {
                    $success = $melisLostPass->addLostPassRequest($login, $email);
                    if($success)
                    {
                        $message = $translator->translate('tr_meliscore_email_lost_password_request_success');
                    }
                    else
                    {
                        $message = $translator->translate('tr_meliscore_email_lost_password_request_failed');
                    }
                }
                else
                {
                    $message = $translator->translate('tr_meliscore_email_lost_password_request_failed');
                }
            }
            else 
            {
                $success = false;
                $message = $translator->translate('tr_meliscore_email_failed');
            }
        }
        
        return new JsonModel(array('success' => $success, 'message' => $message));
    }
public function lostPasswordRequestAction() 
    {
        $pathAppConfigForm = '/meliscore/forms/meliscore_forgot';
        $melisMelisCoreConfig = $this->serviceLocator->get('MelisCoreConfig');
        $appConfigForm = $melisMelisCoreConfig->getItem($pathAppConfigForm);
        $translator = $this->getServiceLocator()->get('translator');
        
        $success = false;
        $errors  = array();
        $message = '';

        
        if($this->getRequest()->isPost())
        {
            $login = $this->getRequest()->getPost('usr_login');
            $email = $this->getRequest()->getPost('usr_email');
            
            $melisLostPass = $this->getServiceLocator()->get('MelisCoreLostPassword');
            $userTable = $this->getServiceLocator()->get('MelisCoreTableUser');
            $userData = $userTable->getDataByLoginAndEmail($login, $email);
            $userData = $userData->current();
            
            if($userData) 
            {
                if($melisLostPass->userExists($login))
                {
                    $success = $melisLostPass->addLostPassRequest($login, $email);
                    if($success)
                    {
                        $message = $translator->translate('tr_meliscore_email_lost_password_request_success');
                    }
                    else
                    {
                        $message = $translator->translate('tr_meliscore_email_lost_password_request_failed');
                    }
                }
                else
                {
                    $message = $translator->translate('tr_meliscore_email_lost_password_request_failed');
                }
            }
            else 
            {
                $success = false;
                $message = $translator->translate('tr_meliscore_email_failed');
            }
        }
        
        return new JsonModel(array('success' => $success, 'message' => $message));
    }
public function lostPasswordRequestAction ( ) { $ pathAppConfigForm = '/meliscore/forms/meliscore_forgot' ; $ melisMelisCoreConfig = $ this -> serviceLocator -> get ( 'MelisCoreConfig' ) ; $ appConfigForm = $ melisMelisCoreConfig -> getItem ( $ pathAppConfigForm ) ; $ translator = $ this -> getServiceLocator ( ) -> get ( 'translator' ) ; $ success = false ; $ errors = array ( ) ; $ message = '' ; if ( $ this -> getRequest ( ) -> isPost ( ) ) { $ login = $ this -> getRequest ( ) -> getPost ( 'usr_login' ) ; $ email = $ this -> getRequest ( ) -> getPost ( 'usr_email' ) ; $ melisLostPass = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreLostPassword' ) ; $ userTable = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreTableUser' ) ; $ userData = $ userTable -> getDataByLoginAndEmail ( $ login , $ email ) ; $ userData = $ userData -> current ( ) ; if ( $ userData ) { if ( $ melisLostPass -> userExists ( $ login ) ) { $ success = $ melisLostPass -> addLostPassRequest ( $ login , $ email ) ; if ( $ success ) { $ message = $ translator -> translate ( 'tr_meliscore_email_lost_password_request_success' ) ; } else { $ message = $ translator -> translate ( 'tr_meliscore_email_lost_password_request_failed' ) ; } } else { $ message = $ translator -> translate ( 'tr_meliscore_email_lost_password_request_failed' ) ; } } else { $ success = false ; $ message = $ translator -> translate ( 'tr_meliscore_email_failed' ) ; } } return new JsonModel ( array ( 'success' => $ success , 'message' => $ message ) ) ; }
Processes the lost password request
@return \Zend\View\Model\JsonModel
Processes the lost password request