Displays the login form and handles the login action.
485159
def login(request, template_name=None,
          redirect_field_name=REDIRECT_FIELD_NAME,
          authentication_form=AuthenticationForm,
          current_app=None, extra_context=None):
    
    redirect_to = request.POST.get(
        redirect_field_name,
        request.GET.get(redirect_field_name, '')
    )

    def get_redirect_to():
        # Ensure the user-originating redirection url is safe.
        if not is_safe_url(url=redirect_to, host=request.get_host()):
            return resolve_url(settings.LOGIN_REDIRECT_URL)
        return redirect_to

    if request.user.is_authenticated:
        return HttpResponseRedirect(get_redirect_to())

    if request.method == "POST":
        form = authentication_form(request=request, data=request.POST)
        if form.is_valid():

            # Okay, security check complete. Log the user in.
            auth_login(request, form.get_user())

            return HttpResponseRedirect(get_redirect_to())
    else:
        form = authentication_form(request=request)

    current_site = get_current_site(request)

    context = {
        'form': form,
        redirect_field_name: redirect_to,
        'site': current_site,
        'site_name': current_site.name,
    }
    if extra_context is not None:
        context.update(extra_context)

    if current_app is not None:
        request.current_app = current_app

    return TemplateResponse(request, template_name, context)
635956
function check_loginout()
	{
		switch (arg('action'))
		{
			case 'login':
				$this->login(arg('user'), $this->password_hash(arg('password')), arg('autologin', 'int'));
				HTTP::redirect($this->request['url']);
			break;
			case 'logout':
				$this->logout(true);
				HTTP::redirect($this->root.'admin/');
			break;
		}
	}
966907
protected function execLoginForm()
    {
        $this->loadTranslations('form', sprintf('private/global/locales/%s/form.ini', LANGUAGE));
        $this->templateParameters['translations'] = $this->translations;
        $this->renderTemplate();
    }
945774
private function handleSuccessfulLogin()
    {
        event(new UserLoggedIn(auth()->user()));

        // Update the user with the log in details.
        auth()->user()->updateLogin();

        return Response::passed('You have been logged in.')
                       ->route('home');
    }
138621
def login(self):
        
        resp = super(CookieSession, self).request(
            'POST',
            self._session_url,
            data={'name': self._username, 'password': self._password},
        )
        resp.raise_for_status()
325832
public function print_login(){
        $url = $this->boxnetclient->get_login_url();
        if ($this->options['ajax']) {
            $ret = array();
            $popup_btn = new stdClass();
            $popup_btn->type = 'popup';
            $popup_btn->url = $url->out(false);
            $ret['login'] = array($popup_btn);
            return $ret;
        } else {
            echo html_writer::link($url, get_string('login', 'repository'), array('target' => '_blank'));
        }
    }
874192
protected void submit() {

        CmsLoginMessage loginMessage = new CmsLoginMessage();
        CmsLoginMessage beforeLoginMessage = new CmsLoginMessage();
        try {
            m_formBinderAfter.writeBean(loginMessage);
            m_formBinderBefore.writeBean(beforeLoginMessage);
            OpenCms.getLoginManager().setLoginMessage(A_CmsUI.getCmsObject(), loginMessage);
            OpenCms.getLoginManager().setBeforeLoginMessage(A_CmsUI.getCmsObject(), beforeLoginMessage);
            // update the system configuration
            OpenCms.writeConfiguration(CmsVariablesConfiguration.class);
        } catch (Exception e) {
            LOG.error("Unable to save Login Message", e);
        }
    }
1234482
public function process()
    {
        switch ($this->inputs['action']) {
            case 'login':
                $this->webLogin();
                break;
            case 'logout':
                $this->webLogout();
                exit($this->showWebLoginForm());
                break;
            case 'getContacts':
                $this->getContacts();
                break;
            case 'updateStatus':
                $this->updateStatus();
                break;
            case 'sendMessage':
                $this->sendMessage();
                break;
            case 'sendBroadcast':
                $this->sendBroadcast();
                break;
            default:
                if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true) {
                    exit($this->showWebForm());
                }
                exit($this->showWebLoginForm());
                break;
        }
    }
328864
public function indexAction()
    {
        // Clear the user identity, if any. (#370)
        if (PHP_SESSION_ACTIVE !== session_status()) {
            session_start();
        }
        session_destroy();

        $form    = $this->installForm;
        $prereqs = $this->plugin('Install/Prerequisites')->check();
    
        return $this->createViewModel(
            array(
                'prerequisites' => $prereqs,
                'form'          => $form,
                'lang'          => $this->params('lang'),
            )
        );
    }
72053
public function checkIsLogin()
    {
        if (!$this->di->get("session")->has("user")) {
            $views = [
                ["comment/user/fail/fail", [], "main"]
            ];
            $this->di->get("pageRenderComment")->renderPage([
                "views" => $views,
                "title" => "Not logged in"
            ]);
        }
    }
240678
public void printLoginForm(WebPage page, LoginException loginException, WebSiteRequest req, HttpServletResponse resp) throws ServletException, IOException, SQLException {
		getParent().printLoginForm(page, loginException, req, resp);
	}
1367175
protected function handlePOST()
    {
        $payload = $this->getPayloadData();
        $login = $this->request->getParameterAsBool('login');
        $registrar = new Registrar();

        $password = array_get($payload, 'new_password', array_get($payload, 'password'));
        $data = [
            'username'              => array_get($payload, 'username'),
            'first_name'            => array_get($payload, 'first_name'),
            'last_name'             => array_get($payload, 'last_name'),
            'name'                  => array_get($payload, 'name'),
            'email'                 => array_get($payload, 'email'),
            'phone'                 => array_get($payload, 'phone'),
            'security_question'     => array_get($payload, 'security_question'),
            'security_answer'       => array_get($payload, 'security_answer'),
            'password'              => $password,
            'password_confirmation' => array_get($payload, 'password_confirmation', $password)
        ];

        if (empty($data['first_name'])) {
            /** @noinspection PhpUnusedLocalVariableInspection */
            list($username, $domain) = explode('@', $data['email']);
            $data['first_name'] = $username;
        }
        if (empty($data['last_name'])) {
            $names = explode('.', $data['first_name']);
            if (isset($names[1])) {
                $data['last_name'] = $names[1];
                $data['first_name'] = $names[0];
            } else {
                $data['last_name'] = $names[0];
            }
        }
        if (empty($data['name'])) {
            $data['name'] = $data['first_name'] . ' ' . $data['last_name'];
        }

        $data = array_filter($data, function ($value) {
            return !is_null($value);
        });

        /** @var \Illuminate\Validation\Validator $validator */
        $validator = $registrar->validator($data);

        if ($validator->fails()) {
            $messages = $validator->errors()->getMessages();

            throw new BadRequestException('Validation failed', null, null, $messages);
        } else {
            $user = $registrar->create($data, $this->getServiceId());

            if ($login) {
                if ($user->confirm_code !== 'y' && !is_null($user->confirm_code)) {
                    return ['success' => true, 'confirmation_required' => true];
                } else {
                    $appId = Session::get('app.id');
                    Session::setUserInfoWithJWT($user, false, $appId);

                    return ['success' => true, 'session_token' => Session::getSessionToken()];
                }
            } else {
                return ['success' => true];
            }
        }
    }
541755
async def login(self, request, id_):
        """"""
        session = await self.load(request)
        session['id'] = id_
917524
public function handleLogout() : void
    {
        if ($this->user->isLoggedIn())
        {
            $this->user->logout(TRUE);

            $this->notification(
                'Odhlášení',
                'Byli jste úspěšně odhlášeni.',
                'success'
            );

            $this->redirect($this instanceof FrontendPresenter ? 'this' : ':User:Admin:Login');
        }
    }
25853
public function editUserLogin()
    {
        $this->controlAccessUserLogin();
        $this->setTitleEditUserLogin();
        $this->setBreadcrumbEditUserLogin();

        $this->submitUserLogin();
        $this->outputEditUserLogin();
    }
305498
public function loginAction() {
        // Do not cache login page
        $this->_helper->cache->setNoCacheHeaders($this->getResponse());

        $this->view->title = __('login page title');
        $this->view->description = __('login page description');

        // allow callers to set a targetUrl via the request
        if ($targetUrl = $this->_getSubmittedTargetUrl()) {
            Garp_Auth::getInstance()->getStore()->targetUrl = $targetUrl;
        }

        $authVars = Garp_Auth::getInstance()->getConfigValues();
        // self::processAction might have populated 'errors' and/or 'postData'
        if ($this->getRequest()->getParam('errors')) {
            $this->view->errors = $this->getRequest()->getParam('errors');
        }
        if ($this->getRequest()->getParam('postData')) {
            $this->view->postData = $this->getRequest()->getParam('postData');
        }
    }
1241735
public function showLoginForm()
	{
		$view = property_exists( $this, 'loginView' ) ? $this->loginView : 'auth.authenticate';
		if ( View::exists( $view ) )
			return View::render( $view );

		return View::render( 'auth.login' );
	}