Check if we have an active login session set
        @rtype: bool
429675
def check(self):
        
        self.log.debug('Testing for a valid login session')
        # If our cookie jar is empty, we obviously don't have a valid login session
        if not len(self.cookiejar):
            return False

        # Test our login session and make sure it's still active
        return requests.get(self.TEST_URL, cookies=self.cookiejar).status_code == 200
55757
def is_active(self):
    
    if self._db_connection_provider:
      # The plugin is active if one relevant tag can be found in the database.
      db = self._db_connection_provider()
      cursor = db.execute(
          '''
          SELECT 1
          FROM Tags
          WHERE Tags.plugin_name = ?
          LIMIT 1
          ''',
          (metadata.PLUGIN_NAME,))
      return bool(list(cursor))

    if not self._multiplexer:
      return False

    all_runs = self._multiplexer.PluginRunToTagToContent(metadata.PLUGIN_NAME)

    # The plugin is active if any of the runs has a tag relevant to the plugin.
    return any(six.itervalues(all_runs))
687450
def confirm_login():
    '''
    
    '''
    session['_fresh'] = True
    session['_id'] = current_app.login_manager._session_identifier_generator()
    user_login_confirmed.send(current_app._get_current_object())
1245475
public function isLogined()
    {
        $session = $this->getSession();
        $cookie = $this->getCookie();

        if ($cookie->has(self::USER_SESSION)) {
            $login = $cookie->get(self::USER_SESSION);
            $login = unserialize(base64_decode($login));
        }elseif (false !== $session->has(self::USER_SESSION)) {
            $login = $session->get(self::USER_SESSION);
        }else{
            return false;
        }

        return $this->isSameIp($login);
    }
839188
def is_auth(self):
        
        if self.user_id is None:
            self.user_id = self.session.get('user_id')
        return bool(self.user_id)
363516
public function isLoggedIn()
    {
        $session = $this->Controller->request->session();
        if ($session->check('Auth.CakeAdmin')) {
            return (bool)$session->read('Auth.CakeAdmin');
        }
        return false;
    }
815898
protected function checkSetUserFrontendLogin()
	{
		if (FE_USER_LOGGED_IN)
		{
		    $this->import('FrontendUser', 'User');
		    
		    if ( $this->arrCategoryValues['banner_protected'] == 1 
		      && $this->arrCategoryValues['banner_group']      > 0 ) 
		    {
		    	if ( $this->User->isMemberOf($this->arrCategoryValues['banner_group']) === false ) 
		    	{
		    		$this->statusBannerFrontendGroupView = false;
		    		return false;
		    	}
		    }
		}
		return true;
	}
193851
def getActiveScans(self, login, tserver):
    
    self.send_getActiveScans(login, tserver)
    return self.recv_getActiveScans()
137340
public function checkBE()
	{
	    if ($this->isContao45()) 
	    {
	        if ($this->_BackendUser)
	        {
                ModuleVisitorLog::writeLog( __METHOD__ , __LINE__ , ': True' );
                return true;
	        }
	        ModuleVisitorLog::writeLog( __METHOD__ , __LINE__ , ': False' );
	        return false;
	    }
		//Contao <4.5.0
	    $strCookie = 'BE_USER_AUTH';
		$hash = sha1(session_id() . (!\Config::get('privacyAnonymizeIp') ? \Environment::get('ip') : '') . $strCookie);
		if (\Input::cookie($strCookie) == $hash)
		{
			// Try to find the session
			$objSession = \SessionModel::findByHashAndName($hash, $strCookie);
			// Validate the session ID and timeout
			if ($objSession !== null && $objSession->sessionID == session_id() && (\Config::get('privacyAnonymizeIp') || $objSession->ip == \Environment::get('ip')) && ($objSession->tstamp + $GLOBALS['TL_CONFIG']['sessionTimeout']) > time())
			{
			    ModuleVisitorLog::writeLog( __METHOD__ , __LINE__ , ': True' );
				return true;
			}
		}
		ModuleVisitorLog::writeLog( __METHOD__ , __LINE__ , ': False' );
		return false;
	}
1323012
def is_active(self):
    
    if not self._multiplexer:
      return False

    scalars_plugin_instance = self._get_scalars_plugin()
    if not (scalars_plugin_instance and
            scalars_plugin_instance.is_active()):
      return False

    # This plugin is active if any run has a layout.
    return bool(self._multiplexer.PluginRunToTagToContent(metadata.PLUGIN_NAME))
1110169
protected function check_login()
    {
        if (file_exists($this->cookie_file)) {
            if (time() - filemtime($this->cookie_file) >= 3600 || filesize($this->cookie_file) == 0) {
                $this->empty_cookie_file();
                $this->logged_in = false;
                return false;
            } else {
                $this->logged_in = true;
                return true;
            }
        } else {
            $this->empty_cookie_file();
            $this->logged_in = false;
            return false;
        }
    }
710496
def checkStatus(self):
        
        checkAccount()

        data = {'userid': self.user_id,
                'useridx': self.useridx
               }
        r = self.session.post(nurls['checkStatus'], data = data)

        p = re.compile(r'\<message\>(?P<message>.+)\</message\>')
        message = p.search(r.text).group('message')

        if message == 'success':
            return True
        else:
            return False
195364
def _verify_authentication(self, handler, args, kwargs):
        
        if not self.user_manager.session_logged_in():
            raise APIForbidden()
        return handler(*args, **kwargs)
896608
def is_running(self):
        
        return self.state in [self.STATE_IDLE, self.STATE_ACTIVE,
                              self.STATE_SLEEPING]
725365
def set_active(self, username, active_state):
        

        if active_state not in (True, False):
            raise ValueError("active_state must be True or False")

        user = self.get_user(username)
        if user is None:
            return None

        if user['active'] is active_state:
            # Already in desired state
            return True

        user['active'] = active_state
        response = self._put(self.rest_url + "/user",
                             params={"username": username},
                             data=json.dumps(user))

        if response.status_code == 204:
            return True

        return None
643813
private boolean hasActiveSessions() {
        final SSLContext sslContext = getSSLContext(sslContextServiceController);
        if (sslContext == null) return false;
        SSLSessionContext sslSessionContext = server ? sslContext.getServerSessionContext() : sslContext.getClientSessionContext();
        return sslSessionContext.getIds().hasMoreElements();
    }
1322007
private function hasSession() {

        if(DI::getDefault()->has('session') === true) {

            // get instance of session class
            $this->session = DI::getDefault()->getSession();

            if($this->session->getId() === '') {
                $this->session->start();
            }

            return true;
        }

        return false;
    }