protected function loginByCookie()
    {
        return $this->getIdentityAndDurationFromCookie()
            ->then(function($data) {
                if (isset($data['identity'], $data['duration'])) {
                    /** @var IdentityInterface $identity */
                    $identity = $data['identity'];
                    $duration = $data['duration'];
                    return $this->beforeLogin($identity, true, $duration)
                        ->then(function() use (&$identity, $duration) {
                            $this->switchIdentity($identity, $this->autoRenewCookie ? $duration : 0);
                            $id = $identity->getId();
                            $ip = $this->request->getUserIP();
                            Reaction::info("User '$id' logged in from $ip via cookie.");
                            return $this->afterLogin($identity, true, $duration);
                        });
                } else {
                    return reject(new Error("Invalid cookie value or user identity"));
                }
            });
    }
protected function loginByCookie()
    {
        return $this->getIdentityAndDurationFromCookie()
            ->then(function($data) {
                if (isset($data['identity'], $data['duration'])) {
                    /** @var IdentityInterface $identity */
                    $identity = $data['identity'];
                    $duration = $data['duration'];
                    return $this->beforeLogin($identity, true, $duration)
                        ->then(function() use (&$identity, $duration) {
                            $this->switchIdentity($identity, $this->autoRenewCookie ? $duration : 0);
                            $id = $identity->getId();
                            $ip = $this->request->getUserIP();
                            Reaction::info("User '$id' logged in from $ip via cookie.");
                            return $this->afterLogin($identity, true, $duration);
                        });
                } else {
                    return reject(new Error("Invalid cookie value or user identity"));
                }
            });
    }
protected function loginByCookie ( ) { return $ this -> getIdentityAndDurationFromCookie ( ) -> then ( function ( $ data ) { if ( isset ( $ data [ 'identity' ] , $ data [ 'duration' ] ) ) { /** @var IdentityInterface $identity */ $ identity = $ data [ 'identity' ] ; $ duration = $ data [ 'duration' ] ; return $ this -> beforeLogin ( $ identity , true , $ duration ) -> then ( function ( ) use ( & $ identity , $ duration ) { $ this -> switchIdentity ( $ identity , $ this -> autoRenewCookie ? $ duration : 0 ) ; $ id = $ identity -> getId ( ) ; $ ip = $ this -> request -> getUserIP ( ) ; Reaction :: info ( "User '$id' logged in from $ip via cookie." ) ; return $ this -> afterLogin ( $ identity , true , $ duration ) ; } ) ; } else { return reject ( new Error ( "Invalid cookie value or user identity" ) ) ; } } ) ; }
Logs in a user by cookie.

This method attempts to log in a user using the ID and authKey information
provided by the [[identityCookie|identity cookie]].
@return ExtendedPromiseInterface
Logs in a user by cookie .