src/Service/MelisCoreLostPasswordService.php
protected function sendPasswordLostEmail($login, $email) 
    {
        $datas = array();
        foreach($this->getPassRequestDataByLogin($login) as $data) {
            $datas['rh_login'] = $data->rh_login;
            $datas['rh_hash'] = $data->rh_hash;
        }
        
        $login = $datas['rh_login'];
        $hash  = $datas['rh_hash'];
        
        $configPath = 'meliscore/datas';
        $melisConfig = $this->getServiceLocator()->get('MelisCoreConfig');
        
        $cfg = $melisConfig->getItem('meliscore/datas/'.getenv('MELIS_PLATFORM'));
        
        if (empty($cfg))
            $cfg = $melisConfig->getItem('meliscore/datas/default');
        
        $isActive = false;
        if (!empty($cfg['emails']))
            if (!empty($cfg['emails']['active']))
                $isActive = true;
            
        $url = $cfg['host'].'/melis/reset-password/'.$hash;
        
        if($isActive){
            // Tags to be replace at email content with the corresponding value
            $tags = array(
                'USER_Login' => $login,
                'URL' => $url
            );
            
            $name_to = $login;
            $email_to = $email;
            
            // Fetching user language Id
            $userTable = $this->getServiceLocator()->get('MelisCoreTableUser');
            $userData = $userTable->getDataByLoginAndEmail($login, $email);
            $userData = $userData->current();
            $langId = $userData->usr_lang_id;
            
            $melisEmailBO = $this->getServiceLocator()->get('MelisCoreBOEmailService');
            $emailResult = $melisEmailBO->sendBoEmailByCode('LOSTPASSWORD',  $tags, $email_to, $name_to, $langId);
            
            if ($emailResult){
                return true;
            }else{
                return false;
            }
        }else{
            return false;
        }
    }
protected function sendPasswordLostEmail($login, $email) 
    {
        $datas = array();
        foreach($this->getPassRequestDataByLogin($login) as $data) {
            $datas['rh_login'] = $data->rh_login;
            $datas['rh_hash'] = $data->rh_hash;
        }
        
        $login = $datas['rh_login'];
        $hash  = $datas['rh_hash'];
        
        $configPath = 'meliscore/datas';
        $melisConfig = $this->getServiceLocator()->get('MelisCoreConfig');
        
        $cfg = $melisConfig->getItem('meliscore/datas/'.getenv('MELIS_PLATFORM'));
        
        if (empty($cfg))
            $cfg = $melisConfig->getItem('meliscore/datas/default');
        
        $isActive = false;
        if (!empty($cfg['emails']))
            if (!empty($cfg['emails']['active']))
                $isActive = true;
            
        $url = $cfg['host'].'/melis/reset-password/'.$hash;
        
        if($isActive){
            // Tags to be replace at email content with the corresponding value
            $tags = array(
                'USER_Login' => $login,
                'URL' => $url
            );
            
            $name_to = $login;
            $email_to = $email;
            
            // Fetching user language Id
            $userTable = $this->getServiceLocator()->get('MelisCoreTableUser');
            $userData = $userTable->getDataByLoginAndEmail($login, $email);
            $userData = $userData->current();
            $langId = $userData->usr_lang_id;
            
            $melisEmailBO = $this->getServiceLocator()->get('MelisCoreBOEmailService');
            $emailResult = $melisEmailBO->sendBoEmailByCode('LOSTPASSWORD',  $tags, $email_to, $name_to, $langId);
            
            if ($emailResult){
                return true;
            }else{
                return false;
            }
        }else{
            return false;
        }
    }
protected function sendPasswordLostEmail ( $ login , $ email ) { $ datas = array ( ) ; foreach ( $ this -> getPassRequestDataByLogin ( $ login ) as $ data ) { $ datas [ 'rh_login' ] = $ data -> rh_login ; $ datas [ 'rh_hash' ] = $ data -> rh_hash ; } $ login = $ datas [ 'rh_login' ] ; $ hash = $ datas [ 'rh_hash' ] ; $ configPath = 'meliscore/datas' ; $ melisConfig = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreConfig' ) ; $ cfg = $ melisConfig -> getItem ( 'meliscore/datas/' . getenv ( 'MELIS_PLATFORM' ) ) ; if ( empty ( $ cfg ) ) $ cfg = $ melisConfig -> getItem ( 'meliscore/datas/default' ) ; $ isActive = false ; if ( ! empty ( $ cfg [ 'emails' ] ) ) if ( ! empty ( $ cfg [ 'emails' ] [ 'active' ] ) ) $ isActive = true ; $ url = $ cfg [ 'host' ] . '/melis/reset-password/' . $ hash ; if ( $ isActive ) { // Tags to be replace at email content with the corresponding value $ tags = array ( 'USER_Login' => $ login , 'URL' => $ url ) ; $ name_to = $ login ; $ email_to = $ email ; // Fetching user language Id $ userTable = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreTableUser' ) ; $ userData = $ userTable -> getDataByLoginAndEmail ( $ login , $ email ) ; $ userData = $ userData -> current ( ) ; $ langId = $ userData -> usr_lang_id ; $ melisEmailBO = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreBOEmailService' ) ; $ emailResult = $ melisEmailBO -> sendBoEmailByCode ( 'LOSTPASSWORD' , $ tags , $ email_to , $ name_to , $ langId ) ; if ( $ emailResult ) { return true ; } else { return false ; } } else { return false ; } }
Sends an email together with the link to the user
@param String $url
@param String $login
@param String $email
Sends an email together with the link to the user