The method checks whether user is logged in and send to home.
165127
public function actionLogin( $admin = false ) {

		// Send user to home if already logged in
		$this->checkHome();

		// Create Form Model
		$model			= new Login();
		$model->admin	= $admin;

		// Load and Validate Form Model
		if( $model->load( Yii::$app->request->post(), 'Login' ) && $model->login() ) {


			// Redirect user to home
			$this->checkHome();
		}

		return $this->render( CoreGlobal::PAGE_LOGIN, [ CoreGlobal::MODEL_GENERIC => $model ] );
	}
1311818
public function loginByRememberMe(): bool {
		
		// build the cookie name
		$cookieName = static::getRememberMeCookieName();

		// check if cookie exists
		if (!isset($_COOKIE[$cookieName])) {
			return FALSE;
		}
			
		// try to unserialize the cookie content
		$content = unserialize($_COOKIE[$cookieName]);
		
		// cookie content is not unserializable
		if (FALSE === $content) {
			return FALSE;
		}

		// check if content exists and RememberMe length
		if (isset($content[0]) and isset($content[1]) and 32==strlen($content[1])) {
			
			// try to load user
			$user = static::getByRememberMe($content[1]);
			
			// if user exists, return it
			if (is_a($user, 'Pair\User')) {
				$user->createSession($content[0]);
				$user->renewRememberMe();
				return TRUE;
			}
		
		}
		
		return FALSE;
	
	}
1229015
@InterfaceAudience.Private
    protected void checkSession() {
        if (getAuthenticator() != null) {
            Authorizer auth = (Authorizer) getAuthenticator();
            auth.setRemoteURL(remote);
            auth.setLocalUUID(db.publicUUID());
        }
        if (getAuthenticator() != null && getAuthenticator() instanceof SessionCookieAuthorizer) {
            // Sync Gateway session API is at /db/_session; try that first
            checkSessionAtPath("_session");
        } else {
            login();
        }
    }
1208943
protected function verifySession()
    {
        // Get the session.
        $session = $this->getSession();

        // Start the session if needed.
        if (! $session->isStarted()) {
            $session->start();
        }

        // If we aren't on a valid page
        if ('about:blank' === $session->getCurrentUrl()) {
            // Go to the home page
            $session->visit('/');
        }

        // Return the session.
        return $session;
    }
479872
def is_homepage?
      return false if (!defined?(@content.length).blank? || @content.blank?)
      @content.id == Setting.get('home_page').to_i	? true : false
    end
874549
function mustBeLoggedIn(req, res, next) {
  if (req.session && req.session.user) {
    next();
  }
  else {
    res.status(401).send('You must be logged-in to access this resource');
  }
}
1084805
public function checkLogin()
    {
        $this->defaultData();
        $userService = $this->getServiceLocator()->get(tao_models_classes_UserService::class);
        if (!$this->isXmlHttpRequest()) {
            throw new common_exception_BadRequest('wrong request mode');
        }

        $data = array('available' => false);
        if ($this->hasRequestParameter('login')) {
            $data['available'] = $userService->loginAvailable($this->getRequestParameter('login'));
        }

        $this->returnJson($data);
    }
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;
    }
902088
private static function __isPageLogin() {
		$params = Router::getParams();

		return (
			!empty($params['controller']) && 'users' == $params['controller']
			&& !empty($params['action']) && 'login' == $params['action']
		);
	}
251770
public function isLogged() {
        if ($this->isAuthenticated === false) {
            $this->isAuthenticated = $this->checkSession($this->getCurrentSessionHash());
        }
        return $this->isAuthenticated;
    }
92541
public function isLoggedIn()
    {
        $isSimulatedLoggedIn = ($this->loggedInUser !== null);
        $isReallyLoggedIn = $this->getFrontEndController() !== null && $this->getFrontEndController()->loginUser;

        return $isSimulatedLoggedIn || $isReallyLoggedIn;
    }
685665
public void doHome(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        if (!common.checkGet(request, response)) return;

        // If nobody's logged in, send the browser to "/".
        User user = common.getLoggedInUser(request);
        if (user == null) {
            response.sendRedirect("/");
            return;
        }

        FormProtection fp = FormProtection.start(response);
        response.setContentType("text/html");
        response.setCharacterEncoding("utf-8");
        PrintWriter out = new PrintWriter(new OutputStreamWriter(response.getOutputStream(), "UTF-8"));

        out.println("<html>");
        out.println("<head><title>Home - Web File Browser</title></head>");
        out.println("<body>");
        fp.insertAntiRedressHtml(out);

        // Show user info.
        out.println("<h2>User: " + escapeHtml4(user.username) + "</h2>");

        if (user.dropboxAccessToken != null) {
            // Show information about linked Dropbox account.  Display the "Unlink" form.
            out.println("<p>Linked to your Dropbox account (" + escapeHtml4(user.dropboxAccessToken) + "), ");
            out.println("<form action='/dropbox-unlink' method='POST'>");
            fp.insertAntiCsrfFormField(out);
            out.println("<input type='submit' value='Unlink Dropbox account' />");
            out.println("</form>");
            out.println("</p>");
            out.println("<p><a href='/browse'>Browse your Dropbox files</a></p>");
        } else {
            // They haven't linked their Dropbox account.  Display the "Link" form.
            out.println("<p><form action='/dropbox-auth-start' method='POST'>");
            fp.insertAntiCsrfFormField(out);
            out.println("<input type='submit' value='Link to your Dropbox account' />");
            out.println("</form></p>");
        }

        // Log out form.
        out.println("<p><form action='/logout' method='POST'>");
        fp.insertAntiCsrfFormField(out);
        out.println("<input type='submit' value='Logout' />");
        out.println("</form></p>");

        out.println("</body>");
        out.println("</html>");
        out.flush();
    }
919082
public boolean onLogout()
    {
        App application = this.getTask().getApplication();
        int iErrorCode = application.login(this.getTask(), null, null, this.getProperty(DBParams.DOMAIN));
        if (iErrorCode != DBConstants.NORMAL_RETURN)
            return false;
        String strMenu = this.getProperty(DBParams.HOME);
        if (strMenu == null)
            strMenu = this.getTask().getProperty(DBParams.MENU);
        if (strMenu != null)
        {
            BasePanel screenParent = this.getParentScreen();
			int count = 0;
			while (screenParent.popHistory(1, false) != null)
			{
				count++;
			}
			count--;	// Want to move back to the first one
			if (count > 0)
				popHistory(count, true);		// Dump all browser history
            Map<String,Object> properties = this.getProperties();
            this.finalizeThisScreen();  // Validate current control, update record, get ready to close screen.
            if (!(this instanceof MenuScreen))
            {
                this.free();
                new MenuScreen(null, null, screenParent, null, ScreenConstants.MAINT_MODE, properties);
            }
            else
                this.doCommand("?" +  DBParams.MENU + '=' + strMenu, this, ScreenConstants.USE_SAME_WINDOW | DBConstants.PUSH_TO_BROWSER);
        }
        return true;   // Should always be successful        
    }
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;
    }
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())
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;
	}
1205688
public function login()
    {
        if (!$this->id()) {
            return false;
        }

        $this->setLastLoginDate('now');
        $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
        if ($ip) {
            $this->setLastLoginIp($ip);
        }

        $this->update([ 'last_login_ip', 'last_login_date' ]);

        $this->saveToSession();

        return true;
    }