yii\web\User::loginByCookie PHP Method

loginByCookie() protected method

This method attempts to log in a user using the ID and authKey information provided by the [[identityCookie|identity cookie]].
protected loginByCookie ( )
    protected function loginByCookie()
    {
        $data = $this->getIdentityAndDurationFromCookie();
        if (isset($data['identity'], $data['duration'])) {
            $identity = $data['identity'];
            $duration = $data['duration'];
            if ($this->beforeLogin($identity, true, $duration)) {
                $this->switchIdentity($identity, $this->autoRenewCookie ? $duration : 0);
                $id = $identity->getId();
                $ip = Yii::$app->getRequest()->getUserIP();
                Yii::info("User '{$id}' logged in from {$ip} via cookie.", __METHOD__);
                $this->afterLogin($identity, true, $duration);
            }
        }
    }