src/Controller/MelisAuthController.php
protected function rememberMe($username, $password)
    {
        $melisCoreConfig = $this->serviceLocator->get('MelisCoreConfig');
        $authCookieConfig = $melisCoreConfig->getItem('meliscore/datas/default/auth_cookies');
        $remember = $authCookieConfig['remember'];

        $user = new SetCookie('cookie1', $this->crypt($username), strtotime($remember));
        $pass = new SetCookie('cookie2', $this->crypt($password), strtotime($remember));
        $remember = new SetCookie('remember', 1, strtotime($remember));

        $this->getResponse()->getHeaders()->addHeader($user);
        $this->getResponse()->getHeaders()->addHeader($pass);
        $this->getResponse()->getHeaders()->addHeader($remember);

        // add code here for the session
        $melisCoreConfig = $this->getServiceLocator()->get('MelisCoreConfig');
        $autoLogoutTimeConf = $melisCoreConfig->getItem('meliscore/datas/default/auto_logout');
        $autoLogoutTime = (int) $autoLogoutTimeConf['after'];

        // automatic logout
        $sessionManager = new SessionManager();
        $sessionManager->rememberMe($autoLogoutTime);
        Container::setDefaultManager($sessionManager);
    }
protected function rememberMe($username, $password)
    {
        $melisCoreConfig = $this->serviceLocator->get('MelisCoreConfig');
        $authCookieConfig = $melisCoreConfig->getItem('meliscore/datas/default/auth_cookies');
        $remember = $authCookieConfig['remember'];

        $user = new SetCookie('cookie1', $this->crypt($username), strtotime($remember));
        $pass = new SetCookie('cookie2', $this->crypt($password), strtotime($remember));
        $remember = new SetCookie('remember', 1, strtotime($remember));

        $this->getResponse()->getHeaders()->addHeader($user);
        $this->getResponse()->getHeaders()->addHeader($pass);
        $this->getResponse()->getHeaders()->addHeader($remember);

        // add code here for the session
        $melisCoreConfig = $this->getServiceLocator()->get('MelisCoreConfig');
        $autoLogoutTimeConf = $melisCoreConfig->getItem('meliscore/datas/default/auto_logout');
        $autoLogoutTime = (int) $autoLogoutTimeConf['after'];

        // automatic logout
        $sessionManager = new SessionManager();
        $sessionManager->rememberMe($autoLogoutTime);
        Container::setDefaultManager($sessionManager);
    }
protected function rememberMe ( $ username , $ password ) { $ melisCoreConfig = $ this -> serviceLocator -> get ( 'MelisCoreConfig' ) ; $ authCookieConfig = $ melisCoreConfig -> getItem ( 'meliscore/datas/default/auth_cookies' ) ; $ remember = $ authCookieConfig [ 'remember' ] ; $ user = new SetCookie ( 'cookie1' , $ this -> crypt ( $ username ) , strtotime ( $ remember ) ) ; $ pass = new SetCookie ( 'cookie2' , $ this -> crypt ( $ password ) , strtotime ( $ remember ) ) ; $ remember = new SetCookie ( 'remember' , 1 , strtotime ( $ remember ) ) ; $ this -> getResponse ( ) -> getHeaders ( ) -> addHeader ( $ user ) ; $ this -> getResponse ( ) -> getHeaders ( ) -> addHeader ( $ pass ) ; $ this -> getResponse ( ) -> getHeaders ( ) -> addHeader ( $ remember ) ; // add code here for the session $ melisCoreConfig = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreConfig' ) ; $ autoLogoutTimeConf = $ melisCoreConfig -> getItem ( 'meliscore/datas/default/auto_logout' ) ; $ autoLogoutTime = ( int ) $ autoLogoutTimeConf [ 'after' ] ; // automatic logout $ sessionManager = new SessionManager ( ) ; $ sessionManager -> rememberMe ( $ autoLogoutTime ) ; Container :: setDefaultManager ( $ sessionManager ) ; }
Remember me function creation cookie

@param string $username
@param string $password
Remember me function creation cookie