Handle the login page submission
960291
public function handleLogin(array $request = [])
    {
        $validator = new \Valitron\Validator($request);
        $validator->rule('required', ['username', 'password']);
        $validator->rule(function ($field, $value, array $params, array $fields) {
            return is_string($value);
        }, ['username', 'password'])->message("Invalid username or password");
        $validator->rule('lengthBetween', 'username', 6, 200);
        $validator->rule('lengthBetween', 'password', 8, 80);
        if ($validator->validate() === false) {
            if (headers_sent() === false) {
                header('X-PHP-Response-Code: 422', true, 422);
            }
            return $this->templates->render("Auth::Login", [
                "messages" => [
                    'error' => 'Incorrect username and/or password',
                    'info' => '',
                    'success' => '',
                    'warning' => ''
                ],
                "username" => $request['username']
            ]);
        }

        $response = $this->core->api('User/login/' . $request['username'], 'POST')->run($request);
        if (headers_sent() === false) {
            foreach ($response["headers"] as $header) {
                header($header[0], $header[1], $header[2]);
            }
        }
        if ($response["headers"][0][2] === 422) {
            return $this->templates->render("Auth::Login", [
                "messages" => [
                    'error' => 'Incorrect username and/or password',
                    'info' => '',
                    'success' => '',
                    'warning' => ''
                ],
                "username" => $request['username']
            ]);
        } elseif (($response["headers"][0][2] - 200) * ($response["headers"][0][2] - 299) <= 0) {
            $this->core->auth()->validate($response["response"]);
            $_SERVER['REQUEST_URI'] = 'GET';
            $this->router->map('GET', '/', "User@showProfile", 'home-page');
            return $this->redirect();
        } else {
            return $this->templates->render("500", [
                "error" => $response['response'],
                "result" => ''
            ]);
        }
    }
794677
private function login()
    {
        if (isset($this->config['connection_password'])) {
            $this->send(Response::pass($this->config['connection_password']));
        }

        $this->send(Response::nick($this->config['nick']));
        $this->send(Response::user(
            $this->config['username'],
            $this->config['realname']
        ));

        if (isset($this->config['password'])) {
            $this->send(Response::msg(
                'NickServ',
                'IDENTIFY ' . $this->config['password']
            ));
        }
    }
612264
def handle(self, user, **options):
        
        monkeypatch_remove_pages_site_restrictions()
        user_model = get_user_model()
        for match in ('username', 'pk', 'email'):
            try:
                u = user_model.objects.get(**{match: user})
                break
            except (user_model.DoesNotExist, ValueError):
                continue
        else:
            raise CommandError(_("User with username/id/email = '%s' not found")
                % user)

        json = sys.stdin.read()
        errors, pages_created = json_to_pages(json, u)
        if errors:
            for e in errors:
                sys.stderr.write(e + '\n')
            raise CommandError(_("Errors encountered while importing JSON"))
        for page, created, messages in pages_created:
            print((_("%s created.") if created else _("%s modified.")) % (
                page.get_complete_slug()))
            for m in messages:
                print(" - " + m)
338690
def handle(self):
        ""
        if not self.authentication_ok():
            return
        if self.DOECHO:
            self.writeline(self.WELCOME)
        self.session_start()
        while self.RUNSHELL:
            read_line = self.readline(prompt=self.PROMPT).strip('\r\n')
            if read_line:
                self.session.transcript_incoming(read_line)
            self.input = self.input_reader(self, read_line)
            self.raw_input = self.input.raw
            if self.input.cmd:
                # TODO: Command should not be converted to upper
                # looks funny in error messages.
                cmd = self.input.cmd.upper()
                params = self.input.params
                if cmd in self.COMMANDS:
                    try:
                        self.COMMANDS[cmd](params)
                    except:
                        logger.exception('Error calling {0}.'.format(cmd))
                        (t, p, tb) = sys.exc_info()
                        if self.handleException(t, p, tb):
                            break
                else:
                    self.writeline('-bash: {0}: command not found'.format(cmd))
                    logger.error("Unknown command '{0}'".format(cmd))
        logger.debug("Exiting handler")
1365202
function loginpage_hook() {
        global $frm;
        global $CFG;
        global $SESSION, $OUTPUT, $PAGE;

        $site = get_site();
        $CASform = get_string('CASform', 'auth_cas');
        $username = optional_param('username', '', PARAM_RAW);
        $courseid = optional_param('courseid', 0, PARAM_INT);

        if (!empty($username)) {
            if (isset($SESSION->wantsurl) && (strstr($SESSION->wantsurl, 'ticket') ||
                                              strstr($SESSION->wantsurl, 'NOCAS'))) {
                unset($SESSION->wantsurl);
            }
            return;
        }

        // Return if CAS enabled and settings not specified yet
        if (empty($this->config->hostname)) {
            return;
        }

        // If the multi-authentication setting is used, check for the param before connecting to CAS.
        if ($this->config->multiauth) {

            // If there is an authentication error, stay on the default authentication page.
            if (!empty($SESSION->loginerrormsg)) {
                return;
            }

            $authCAS = optional_param('authCAS', '', PARAM_RAW);
            if ($authCAS != 'CAS') {
                return;
            }

        }

        // Connection to CAS server
        $this->connectCAS();

        if (phpCAS::checkAuthentication()) {
            $frm = new stdClass();
            $frm->username = phpCAS::getUser();
            $frm->password = 'passwdCas';
            $frm->logintoken = \core\session\manager::get_login_token();

            // Redirect to a course if multi-auth is activated, authCAS is set to CAS and the courseid is specified.
            if ($this->config->multiauth && !empty($courseid)) {
                redirect(new moodle_url('/course/view.php', array('id'=>$courseid)));
            }

            return;
        }

        if (isset($_GET['loginguest']) && ($_GET['loginguest'] == true)) {
            $frm = new stdClass();
            $frm->username = 'guest';
            $frm->password = 'guest';
            $frm->logintoken = \core\session\manager::get_login_token();
            return;
        }

        // Force CAS authentication (if needed).
        if (!phpCAS::isAuthenticated()) {
            phpCAS::setLang($this->config->language);
            phpCAS::forceAuthentication();
        }
    }
358933
private function redirectPost()
    {
        if (!isset($_SERVER['REQUEST_URI'])) {
            return;
        }
        if (!isset($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] != 'POST') {
            return;
        }
        if (!$this->cfg['prg']) {
            return;
        }
        if (!$this->status['submitted']) {
            return;
        }
        $this->debug->log('redirecting');
        $event = $this->eventManager->publish('page.redirect', null, array('location' => $_SERVER['REQUEST_URI']));
        $location = $event['location'];
        $this->debug->log('%cLocation:%c <a href="%s">%s</a>', 'font-weight:bold;', '', $location, $location);
        if (\headers_sent($file, $line)) {
            $this->debug->warn('headers alrady sent from '.$file.' line '.$line);
            return;
        }
        if ($event->isPropagationStopped()) {
            $this->debug->alert('<i class="fa fa-external-link fa-lg" aria-hidden="true"></i> Location: <a class="alert-link" href="'.\htmlspecialchars($location).'">'.\htmlspecialchars($location).'</a>', 'info');
        } else {
            \header('Location: '.$location);
        }
        throw new \Exception('exit');
    }
105441
def login_view(request):
    '''  '''
    ANONYMOUS_SESSION = request.session.get('ANONYMOUS_SESSION', False)
    page_name = "Login Page"
    redirect_to = request.GET.get('next', reverse('homepage'))
    if (request.user.is_authenticated() and not ANONYMOUS_SESSION) or (ANONYMOUS_SESSION and request.user.username != ANONYMOUS_USERNAME):
        return HttpResponseRedirect(redirect_to)
    form = LoginForm(request.POST or None)
    if form.is_valid():
        user = form.save()
        login(request, user)
        if ANONYMOUS_SESSION:
            request.session['ANONYMOUS_SESSION'] = True
        return HttpResponseRedirect(redirect_to)
    elif request.method == "POST":
        reset_url = request.build_absolute_uri(reverse('reset_pw'))
        messages.add_message(request, messages.INFO,
                             MESSAGES['RESET_MESSAGE'].format(reset_url=reset_url))

    return render_to_response('login.html', {
        'page_name': page_name,
        'form': form,
        'oauth_providers': _get_oauth_providers(),
        'redirect_to': redirect_to,
        }, context_instance=RequestContext(request))
218231
void submit() {

        try {
            // Special user info attributes may have been set since the time the dialog was instantiated,
            // and we don't want to overwrite them, so we read the user again.
            m_user = m_context.getCms().readUser(m_user.getId());
            m_form.submit(m_user, m_context.getCms(), new Runnable() {

                public void run() {

                    try {
                        m_context.getCms().writeUser(m_user);
                        m_context.finish(Collections.<CmsUUID> emptyList());
                        m_context.updateUserInfo();
                    } catch (CmsException e) {
                        //
                    }
                }
            });
        } catch (CmsException e) {
            LOG.error("Unable to read user", e);
        }
    }
1193072
function () {
			this.writeDebug('_formEventHandler');
			var _this = this;
			// ASP.net or regular submission?
			if (this.settings.noForm === true) {
				$(document).on('click.'+pluginName, '.' + this.settings.formContainer + ' button', function (e) {
					_this.processForm(e);
				});
				$(document).on('keydown.'+pluginName, function (e) {
					if (e.keyCode === 13 && $('#' + _this.settings.addressID).is(':focus')) {
						_this.processForm(e);
					}
				});
			}
			else {
				$(document).on('submit.'+pluginName, '#' + this.settings.formID, function (e) {
					_this.processForm(e);
				});
			}

			// Reset button trigger
			if ($('.bh-sl-reset').length && $('#' + this.settings.mapID).length) {
				$(document).on('click.' + pluginName, '.bh-sl-reset', function () {
					_this.mapReload();
				});
			}
		}
997178
private function handleStrict(): void
    {
        if (!ini_get('session.use_strict_mode') || headers_sent()) {
            return;
        }

        $cookieName = session_name();
        if (empty($_COOKIE[$cookieName])) {
            return;
        }

        $sessionId = $_COOKIE[$cookieName];

        $identifier = $this->cryptProvider->makeSessionIdentifier($sessionId);

        if ($this->storageDriver->sessionExists($identifier)) {
            return;
        }

        $newSessionId = session_create_id();
        session_id($newSessionId);
    }
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);
        }
    }
389686
void submit() {

        String siteRoot = (String)m_siteComboBox.getValue();
        if (!m_context.getCms().getRequestContext().getSiteRoot().equals(siteRoot)) {
            A_CmsUI.get().changeSite(siteRoot);
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(siteRoot) || OpenCms.getSiteManager().isSharedFolder(siteRoot)) {
                // switch to explorer view when selecting shared or root site

                Page.getCurrent().open(CmsCoreService.getFileExplorerLink(A_CmsUI.getCmsObject(), siteRoot), "_top");
                return;
            }
        } else {
            siteRoot = null;
        }
        m_context.finish(null, siteRoot);
    }
1064901
function password_handler()
    {
        $keyid  = rcube_utils::get_input_value('_keyid', rcube_utils::INPUT_POST);
        $passwd = rcube_utils::get_input_value('_passwd', rcube_utils::INPUT_POST, true);

        if ($keyid && $passwd !== null && strlen($passwd)) {
            $this->save_password(strtoupper($keyid), $passwd);
        }
    }
722719
function handler() {
        try {
          if (this.readyState === this.DONE) {

            var response = _buildResponse(this, options.fullResponse);

            // Resolve or reject promise given the response status.
            // HTTP status of 2xx is considered a success.
            if (this.status >= 200 && this.status < 300) {

              if (successCallback) {
                Logger.warnCallbackDeprecation();
                successCallback(response);
              }
              resolve(response);

            } else {
              errorHandler(response);
            }
          }
        } catch (exception) {
          // Do nothing, will be handled by ontimeout.
        }
      }
1133941
def login():
    """"""
    if request.method == "POST":
        username = request.form["username"]
        password = request.form["password"]
        error = None
        user = User.query.filter_by(username=username).first()

        if user is None:
            error = "Incorrect username."
        elif not user.check_password(password):
            error = "Incorrect password."

        if error is None:
            # store the user id in a new session and return to the index
            session.clear()
            session["user_id"] = user.id
            return redirect(url_for("index"))

        flash(error)

    return render_template("auth/login.html")
1170095
def handle_form_submit(self):
        
        protect.CheckAuthenticator(self.request)
        logger.info("Handle ResultsInterpration Submit")
        # Save the results interpretation
        res = self.request.form.get("ResultsInterpretationDepts", [])
        self.context.setResultsInterpretationDepts(res)
        self.add_status_message(_("Changes Saved"), level="info")
        # reindex the object after save to update all catalog metadata
        self.context.reindexObject()
        # notify object edited event
        event.notify(ObjectEditedEvent(self.context))
612291
void submit() {

        try {
            saveData();
            m_context.finish(null);
        } catch (Exception e) {
            m_context.error(e);
        }
    }