Return boolean if is logged in
357648
def logged_in(self):
        
        if "oauth-access-token" not in self.store:
            return False

        response = self.request("/api/whoami", allow_redirects=False)

        # It should response with a redirect to our profile if it's logged in
        if response.status_code != 302:
            return False

        # the location should be the profile we have
        if response.headers["location"] != self.me.links["self"]:
            return False

        return True
473765
def logged_in(f):
    

    @wraps(f)
    def wrapped_method(self, *args, **kwargs):
        if not self.reddit.is_oauth_session():
            self.term.show_notification('Not logged in')
            return None
        return f(self, *args, **kwargs)
    return wrapped_method
1349054
def logged_in?
      validate_token
      validate_cookie
      return true if !session["app_user"].nil? && session["app_user"] != false && session["app_user"].id != -1 && session["app_user"].id != User.logged_out_user_id(@site.id)
      return false
    end
1281654
public static function checkLogin()
	{
		// Only try to authenticate in the front end
		if (TL_MODE !== 'FE') {
			return false;
		}

		// Do not create a user instance if there is no authentication cookie
		if (! is_subclass_of('BackendUser', UserInterface::class) && ! \Input::cookie('BE_USER_AUTH')) {
			return false;
		}

		$User = FrontendHelperUser::getInstance();

		if (! $User->authenticate()) {
			return false;
		}

		if (! $User->rocksolidFrontendHelper) {
			return false;
		}

		if ($User->isAdmin) {
			return array('feModules', 'beModules', 'pages', 'articles', 'contents', 'infos', 'rstAssistant', 'tpl_editor');
		}

		$permissions = array();
		if (is_array($User->rocksolidFrontendHelperOperations)) {
			$permissions = array_merge($permissions, $User->rocksolidFrontendHelperOperations);
		}
		if ($User->hasAccess('rocksolid_theme_assistant', 'modules')) {
			$permissions[] = 'rstAssistant';
		}
		if ($User->hasAccess('tpl_editor', 'modules')) {
			$permissions[] = 'tpl_editor';
		}

		if (count($permissions)) {
			return $permissions;
		}

		return false;
	}
175250
def user_logged_in=(logged_in_option)
      raise JSS::InvalidDataError, "user_logged_in options: #{USER_LOGGED_IN.join(', ')}" unless USER_LOGGED_IN.include? logged_in_option
      @reboot_options[:user_logged_in] = logged_in_option
      @need_to_update = true
    end
446221
public function isLoggedIn() {
        $hasUserData    = isset($this->_store->userData);
        $hasLoginMethod = isset($this->_store->method);
        $hasValidToken  = isset($this->_store->token) && $this->validateToken();
        $isLoggedIn     = $hasUserData && $hasLoginMethod && $hasValidToken;

        // Don't leave invalid cookies laying around.
        // Clear data only when data is present, but it is invalid.
        if ($hasUserData && $hasLoginMethod && !$hasValidToken) {
            $this->_store->userData = null;
            $this->_store->method   = null;
        }
        return $isLoggedIn;
    }
871298
def given_i_am_logged_in(context, username):
    
    user = get_user_model().objects.get(username=username)
    context.apiClient.force_authenticate(user=user)
979192
public function isLogged()
    {
        if (is_null($this->logged)) {
            $this->logged = (bool)is_user_logged_in();
        }

        return $this->logged;
    }
1216359
public function isLogged()
    {
        return $this->get('security.token_storage')->getToken() && $this->get('security.token_storage')->getToken()->isAuthenticated() && is_object($this->getUser());
    }
651746
public function isLogged()
    {
        $this->byPassIsLogged = true;
        try {
            // Is a session mechanism available?
            if (!session_id()) {
                if ($this->sessionManager) {
                    $this->sessionManager->start();
                } else {
                    throw new MoufException("The session must be initialized before checking if the user is logged. Please use session_start().");
                }
            }
            
            if (isset($_SESSION[$this->sessionPrefix.'MoufUserId'])) {
                return true;
            } else {
                foreach ($this->authProviders as $provider) {
                    /* @var $provider AuthenticationProviderInterface */
                    if ($provider->isLogged($this)) {
                        return true;
                    }
                }
            }
        } catch (\Exception $e) {
            $this->byPassIsLogged = false;
            throw $e;
        }
        $this->byPassIsLogged = false;
        return false;
    }
239582
public function getIsLogin(){
        if(isset($_SESSION[$this->storeKey])) return true;
        if(!empty($_COOKIE[$this->storeKey])){
            $data = $this->authCode($_COOKIE[$this->storeKey],'DECODE');
            $this->identity = json_decode($data,true);
            $this->saveLoginSession();
        }
        return false;
    }
313354
public static function check()
    {
        if (Session::exists(static::resource('session'))) {
            return true;
        } elseif (Cookie::existe(static::resource('cookie'))) {
            $token = Cookie::get(static::resource('cookie'));

            $result = Query::from(config('auth.table'))
                ->where('rememberToken', '=', $token)
                ->get();

            if (count($result) > 0) {
                return true;
            }

            return false;
        }

        return false;
    }
1070413
public function checkSession ($session = FALSE)
	{
		
		// If there is no session, get it
		
		if ($session === FALSE)
		{
			$session	= $this->getSessionData ();
		}
		
		// No id
		
		if (!Parser::_ak ($session, 'id', FALSE))
		{
			return 'no_id';
		}
		
		// No email
		
		if (!Parser::_ak ($session, 'email', FALSE))
		{
			return 'no_email';
		}
		
		// No login timestamp
		
		if (!Parser::_ak ($session, 'login_timestamp', FALSE))
		{
			return 'no_login_timestamp';
		}
		
		// No last action
		
		if (!Parser::_ak ($session, 'last_action', FALSE))
		{
			return 'no_last_action';
		}
		
		// No active status
		
		if (!Parser::_ak ($session, 'active', FALSE))
		{
			return 'no_active';
		}
		
		// return TRUE
		
		return TRUE;
		
	}
255961
public function isLoggedIn()
    {
        if ($this->instance instanceof \Phavour\Session\Storage) {
            if ($this->instance->get('identity') != false) {
                return true;
            }
        }

        return false;
    }
1344789
def isLoggedIn(self):
        
        # Send a request to the login url, to see if we're directed to the home page
        r = self._cleanGet(self.req_url.LOGIN, allow_redirects=False)
        return "Location" in r.headers and "home" in r.headers["Location"]
902088
private static function __isPageLogin() {
		$params = Router::getParams();

		return (
			!empty($params['controller']) && 'users' == $params['controller']
			&& !empty($params['action']) && 'login' == $params['action']
		);
	}
1227317
def load_logged_in_user():
    """"""
    user_id = session.get("user_id")
    g.user = User.query.get(user_id) if user_id is not None else None