Attempt social login and return boolean result
979964
def attempt_social_login(self, provider, id):
        
        if not provider or not id:
            return False

        params = dict()
        params[provider.lower() + '_id'] = id
        user = self.first(**params)
        if not user:
            return False

        self.force_login(user)
        return True
1327521
def login_generic(request, username, password):
        """"""
        user = authenticate(username=username, password=password)
        if user is not None and user.is_active:
            login(request, user)
            return True
        return False
1321967
async def _post_login_page(self, token):
        """"""
        data = {"usrname": self.username,
                "pwd": self.password,
                "_csrf_security_token": token}

        try:
            async with async_timeout.timeout(10):
                raw_res = await self._session.post(LOGIN_URL,
                                                   data=data,
                                                   allow_redirects=False,
                                                   timeout=self._timeout)
        except OSError:
            raise PyEboxError("Can not submit login form")
        if raw_res.status != 302:
            raise PyEboxError("Bad HTTP status code")
        # search for errors
        re_results = re.search(r"err=[^&]*&", raw_res.headers.get('Location'))
        if re_results:
            await self._handle_login_error(raw_res.headers.get('Location'))
        return True
1083350
def login(token, apikey, username, password):
    
    if manual_login_success(token, username, password):
        return

    if not apikey:
        if has_browser():
            apikey = wait_for_apikey()
        else:
            floyd_logger.error(
                "No browser found, please login manually by creating login key at %s/settings/apikey.",
                floyd.floyd_web_host)
            sys.exit(1)

    if apikey:
        user = AuthClient().get_user(apikey, is_apikey=True)
        AuthConfigManager.set_apikey(username=user.username, apikey=apikey)
        floyd_logger.info("Login Successful as %s", user.username)
    else:
        floyd_logger.error("Login failed, please see --help for other login options.")
261291
private void onSignInResult(int rstCode, SignInHuaweiId result) {
        HMSAgentLog.i("signIn:callback=" + StrUtils.objDesc(handler) +" retCode=" + rstCode);
        if (handler != null) {
            new Handler(Looper.getMainLooper()).post(new CallbackResultRunnable<SignInHuaweiId>(handler, rstCode, result));
            handler = null;
        }
        signInResultForDispose = null;
        retryTimes = MAX_RETRY_TIMES;
    }
351028
def login(self) -> bool:
        
        response = self.get(self.LOGIN_URL)
        login_url = get_base_url(response.text)
        login_data = {'email': self._login, 'pass': self._password}
        login_response = self.post(login_url, login_data)
        url_params = get_url_params(login_response.url)
        self.check_for_additional_actions(url_params,
                                          login_response.text,
                                          login_data)
        if 'remixsid' in self.cookies or 'remixsid6' in self.cookies:
            return True
126912
def follow(self, login):
        
        resp = False
        if login:
            url = self._build_url('user', 'following', login)
            resp = self._boolean(self._put(url), 204, 404)
        return resp
884199
function doLogin(req, user, callback) {
	req.logIn(user, function(err) {
		if (err) {
			logger.error(err);
			return callback(err);
		}
		user.login_timestamp = Date.now();
		fileUtil.getMetastoreSafe(req).then(function(store) {
			store.updateUser(user.username, user, function(err) {
				if (err) {
					logger.error(err);
					return callback(err);
				}
				callback(null);
			});
		}, function noMetastore(err) {
			callback(err);
		});
	});
}
1267792
def _callback_factory(callback_imp):
    """"""
    if callback_imp is None:
        try:
            pkg_resources.get_distribution('flask-login')
            from flask_login import current_user
            return lambda: current_user.is_authenticated
        except pkg_resources.DistributionNotFound:
            return lambda: False
    elif isinstance(callback_imp, string_types):
        return import_string(callback_imp)
    else:
        return callback_imp
1099202
async function tryExample () {
  // Use the connected resource
  const {User} = db.resources
  let user = await User.create({username: 'Black Fire', password: 'Super Cool'})
  /* ... */
}
461204
function(callback) {
            var that = this;
            var url = this.paths.login;
            var params = {
                username: this.username,
                password: this.password,
                cookie  : '1'
            };

            callback = callback || function() {};
            var wrappedCallback = function(err, response) {
                // Let's make sure that not only did the request succeed, but
                // we actually got a non-empty session key back.
                var hasSessionKey = !!(!err && response.data && response.data.sessionKey);

                if (err || !hasSessionKey) {
                    callback(err || "No session key available", false);
                }
                else {
                    that.sessionKey = response.data.sessionKey;
                    callback(null, true);
                }
            };

            return this.http.post(
                this.urlify(url),
                this._headers(),
                params,
                this.timeout,
                wrappedCallback
            );
        }
646555
def login(username, password, development_mode=False):
        """"""
        retval = None
        try:
            user = User.fetch_by(username=username)
            if user and (development_mode or user.verify_password(password)):
                retval = user
        except OperationalError:
            pass
        return retval
872761
def login():
    """"""

    form_class = _security.login_form

    if request.is_json:
        form = form_class(MultiDict(request.get_json()))
    else:
        form = form_class(request.form)

    if form.validate_on_submit():
        login_user(form.user, remember=form.remember.data)
        after_this_request(_commit)

        if not request.is_json:
            return redirect(get_post_login_redirect(form.next.data))

    if request.is_json:
        return _render_json(form, include_auth_token=True)

    return _security.render_template(config_value('LOGIN_USER_TEMPLATE'),
                                     login_user_form=form,
                                     **_ctx('login'))
377253
function login(options) {

    // Return promise and resolve once user info is retrieved.
    return new Promise(function (resolve, reject) {

      FB.login(function (response) {

        /*response = authResponse + status*/
        _getUser(response).then(function (userResponse) {

          if(userResponse.user) {

            /*userResponse = authResponse + status + user*/
            resolve(userResponse);

          } else {

            // Reject login promise if the user canceled the FB login.
            reject(userResponse);

          }

        });

      }, options);

    });
  }
1154083
@Override
    public boolean login() throws LoginException {
        if ((getShared().isUseFirstPass() || getShared().isTryFirstPass()) && getShared().isHasSharedAuth()) {
            debug(
                    String.format(
                            "JettyCombinedLdapLoginModule: login with shared auth, " +
                            "try? %s, use? %s",
                            getShared().isTryFirstPass(),
                            getShared().isUseFirstPass()
                    )
            );
            setAuthenticated(
                    authenticate(
                            getShared().getSharedUserName(),
                            getShared().getSharedUserPass()
                    )
            );
        }

        if (getShared().isUseFirstPass() && getShared().isHasSharedAuth()) {
            //finish with shared password auth attempt
            debug(String.format("AbstractSharedLoginModule: using login result: %s", isAuthenticated()));
            if (isAuthenticated()) {
                wasAuthenticated(getShared().getSharedUserName(), getShared().getSharedUserPass());
            }
            return isAuthenticated();
        }
        if (getShared().isHasSharedAuth()) {
            if (isAuthenticated()) {
                return isAuthenticated();
            }
            debug(String.format("AbstractSharedLoginModule: shared auth failed, now trying callback auth."));
        }
        Object[] userPass = new Object[0];
        try {
            userPass = getCallBackAuth();
        } catch (IOException e) {
            if (isDebug()) {
                e.printStackTrace();
            }
            throw new LoginException(e.toString());
        } catch (UnsupportedCallbackException e) {
            if (isDebug()) {
                e.printStackTrace();
            }
            throw new LoginException(e.toString());
        }
        if (null == userPass || userPass.length < 2) {
            setAuthenticated(false);
        } else {
            String name = (String) userPass[0];
            Object pass = userPass[1];
            setAuthenticated(authenticate(name, pass));

            if (isAuthenticated()) {
                wasAuthenticated(name, pass);
            }
        }
        return isAuthenticated();
    }
1111577
def login(self):
        """"""
        self._username = input("Username:")
        self._password = getpass.getpass("Password:")
        if self.get_auth_token():
            _LOGGER.debug("Login successful!")
            return True
        _LOGGER.warning("Unable to login with %s.", self._username)
        return False
1158747
function doLogin (opts, csrf, email, password) {
  return fetch(`${opts.host}/_/auth/login`, json({
    ...opts,
    method: 'post',
    body: { csrf, email, password }
  })).then((response) => props({
    session: getSessionCookie(response.headers.get('set-cookie')),
    body: getJSON(response)
  }))
}