protected function loginWithCookie()
    {
        $username = $this->request->getCookie('login.username');
        $password = $this->request->getCookie('login.password');

        //Checks if the cookies exist
        if (!$username || !$password) {
            return;
        }

        //Tries to login
        $this->request = $this->request->withParsedBody(compact('username', 'password'));
        $user = $this->Auth->identify();
        if (!$user || !$user['active'] || $user['banned']) {
            return $this->buildLogout();
        }

        $this->Auth->setUser($user);
        $this->LoginRecorder->setConfig('user', $user['id'])->write();

        return $this->redirect($this->Auth->redirectUrl());
    }
protected function loginWithCookie()
    {
        $username = $this->request->getCookie('login.username');
        $password = $this->request->getCookie('login.password');

        //Checks if the cookies exist
        if (!$username || !$password) {
            return;
        }

        //Tries to login
        $this->request = $this->request->withParsedBody(compact('username', 'password'));
        $user = $this->Auth->identify();
        if (!$user || !$user['active'] || $user['banned']) {
            return $this->buildLogout();
        }

        $this->Auth->setUser($user);
        $this->LoginRecorder->setConfig('user', $user['id'])->write();

        return $this->redirect($this->Auth->redirectUrl());
    }
protected function loginWithCookie ( ) { $ username = $ this -> request -> getCookie ( 'login.username' ) ; $ password = $ this -> request -> getCookie ( 'login.password' ) ; //Checks if the cookies exist if ( ! $ username || ! $ password ) { return ; } //Tries to login $ this -> request = $ this -> request -> withParsedBody ( compact ( 'username' , 'password' ) ) ; $ user = $ this -> Auth -> identify ( ) ; if ( ! $ user || ! $ user [ 'active' ] || $ user [ 'banned' ] ) { return $ this -> buildLogout ( ) ; } $ this -> Auth -> setUser ( $ user ) ; $ this -> LoginRecorder -> setConfig ( 'user' , $ user [ 'id' ] ) -> write ( ) ; return $ this -> redirect ( $ this -> Auth -> redirectUrl ( ) ) ; }
Internal method to login with cookie
@return \Cake\Network\Response|null|void
@uses MeCms\Controller\Component\LoginRecorderComponent::write()
@uses buildLogout()
Internal method to login with cookie