Perform the login
167210
protected function performLogin($user, $rememberMe = true)
    {
        // log user in
        $loginDuration = $rememberMe ? $this->module->loginDuration : 0;
        Yii::$app->user->login($user, $loginDuration);

        // check for a valid returnUrl (to prevent a weird login bug)
        //   https://github.com/amnah/yii2-user/issues/115
        $loginRedirect = $this->module->loginRedirect;
        $returnUrl = Yii::$app->user->getReturnUrl($loginRedirect);
        if (strpos($returnUrl, "user/login") !== false || strpos($returnUrl, "user/logout") !== false) {
            $returnUrl = null;
        }

        return $returnUrl;
    }
1333655
def login(self, email=None, password=None):
        """"""
        auth_url = self.url('auth')
        email = email or self._config.get('email')
        password = password or self._config.get('password')
        if password and not email:
            raise Exception('Email must be provided when password is.')
        while True:
            if not email:
                sys.stdout.write('Email: ')
                sys.stdout.flush()
                email = sys.stdin.readline().strip()
                if not email:
                    print('Goodbye!')
                    sys.exit(1)
            if not password:
                password = getpass.getpass('Password for {0}: '.format(email))
            response = self.request(auth_url, 'PUT', email=email,
                                    password=password)
            if response.status_code == 201:
                print('logged in as {0}'.format(email))
                self.save_prompt(email, password)
                self.email = email
                break
            else:
                print(response.json()['messages'])
                email = password = None
699531
def login(self, schema, username, password):
        
        self.schema = schema
        self.username = username
        self.password = password
        self.connection = schema
1351909
def login(self, username, password):
        
        d = self.send_command('login', keys={'client_login_name': username, 'client_login_password': password})
        if d == 0:
            self._log.info('Login Successful')
            return True
        return False
510156
def login(self, user=None, password=None, **kwargs):
        
        headers = self._generate_headers()
        self.s.headers.update(headers)

        # init cookie
        self.s.get(self.LOGIN_PAGE)

        # post for login
        params = self.create_login_params(user, password, **kwargs)
        rep = self.s.post(self.LOGIN_API, data=params)

        self.check_login_success(rep)
        log.info("登录成功")
956593
def login(self):
        
        log.debug('performing auth test')
        test = self._get(urls['test'])
        user = User({ 'name': test['user'], 'id': test['user_id'] })
        self._refresh()
        return test['team'], user
796239
def _login(self, username, password):
        '''
        '''
        logger.debug('login in as user "%s"' % username)
        url = self._build_url('/auth')
        payload = {'username': username, 'password': password}
        res = self._session.post(url, json=payload)
        res.raise_for_status()
        self._access_token = res.json()['access_token']
        self._session.headers.update(
            {'Authorization': 'JWT %s' % self._access_token}
        )
705216
public function Login()
	{
		$user = new ExampleUser();
		
		if ($user->Login(RequestUtil::Get('username'), RequestUtil::Get('password')))
		{
			// login success
			$this->SetCurrentUser($user);
			$this->Redirect('SecureExample.UserPage');
		}
		else
		{
			// login failed
			$this->Redirect('SecureExample.LoginForm','Unknown username/password combination');
		}
	}
480797
public function login()
    {

        // initialize the flag for the successfull login
        $this->loginOk = false;

        // array containing the username and password from the user's input
        list ($this->username, $password) = $this->getUsernameAndPassword();

        // query whether or not password AND username are set
        if ($this->username === null && $password === null) {
            $this->identity = $this->unauthenticatedIdentity;
        }

        // try to create a identity based on the given username
        if ($this->identity === null) {
            try {
                $this->identity = $this->createIdentity($this->username);
            } catch (\Exception $e) {
                throw new LoginException(
                    sprintf('Failed to create principal: %s', $e->getMessage())
                );
            }
        }

        // connect to the LDAP server
        $ldapConnection = $this->ldapConnect();

        // replace the placeholder  with the actual username of the user
        $this->baseFilter = preg_replace('/\{0\}/', "$this->username", $this->baseFilter);

        // try to load the user from the LDAP server
        $search = ldap_search($ldapConnection, $this->baseDN, $this->baseFilter);
        $entry = ldap_first_entry($ldapConnection, $search);
        $this->userDN = ldap_get_dn($ldapConnection, $entry);

        // query whether or not the user is available
        if (!isset($this->userDN)) {
            throw new LoginException('User not found in LDAP directory');
        }

        // bind the authenticating user to the LDAP directory
        if ((ldap_bind($ldapConnection, $this->userDN, $password)) === false) {
            throw new LoginException('Username or password wrong');
        }

        // query whether or not password stacking has been activated
        if ($this->getUseFirstPass()) {
            // add the username and password to the shared state map
            $this->sharedState->add(SharedStateKeys::LOGIN_NAME, $this->username);
            $this->sharedState->add(SharedStateKeys::LOGIN_PASSWORD, $this->credential);
        }

        // set the login flag to TRUE and return
        return $this->loginOk = true;
    }
324102
def login(self, username, password):
        '''
        '''
        response = self.request(
            ACCESS_TOKEN,
            {
                'x_auth_mode': 'client_auth',
                'x_auth_username': username,
                'x_auth_password': password
            },
            returns_json=False
        )
        token = dict(parse_qsl(response['data'].decode()))
        self.token = oauth.Token(
            token['oauth_token'], token['oauth_token_secret'])
        self.oauth_client = oauth.Client(self.consumer, self.token)
779806
def login(self, username, password, application, application_url):
        """"""
        logger.debug(str((username, application, application_url)))
        method = self._anaconda_client_api.authenticate
        return self._create_worker(method, username, password, application,
                                   application_url)
1244724
public void login() throws Exception {
    WikiUser wuser = WikiUser.getUser(getWikiid(), getSiteurl());
    if (wuser == null) {
      throw new Exception(
          "user for " + getWikiid() + "(" + getSiteurl() + ") not configured");
    }
    // wiki.setDebug(true);
    try {
      Login login = login(wuser.getUsername(), wuser.getPassword());
      LOGGER.log(Level.INFO, this.siteurl + this.scriptPath + this.apiPath + ":"
          + login.getResult());
      if (!"Success".equals(login.getResult())) {
        throw new Exception("login for '" + wuser.getUsername() + "' at '"
            + getWikiid() + "(" + this.getSiteurl() + this.getScriptPath()
            + ")' failed: " + login.getResult());
      }
    } catch (javax.net.ssl.SSLHandshakeException she) {
      String msg = "login via SSL  to " + this.getSiteurl() + " failed\n";
      msg += "Exception: " + she.getMessage();
      throw new Exception(msg);
    }
  }
467912
def login(user, password)
      @user = user
      @password = password

      response = call_remote(:login, [:username, user, :password, password])

      raise "Incorrect user name / password [#{response.fault}]" unless response.loginResponse

      result = response[:loginResponse][:result]
      @session_id = result[:sessionId]

      init_server(result[:serverUrl])

      response
    end
432434
protected function login()
    {
        $this->state = self::CONN_STATE_LOGIN_PACKET_SENT;
        $this->write(
            "Action: login\r\n"
            . "Username: " . $this->username . "\r\n"
            . "Secret: " . $this->secret . "\r\n"
            . "Events: on\r\n"
            . "\r\n"
        );
    }
231818
def _make_login(self):
        
        login_url = '{}data/v1/session/login?user={}&pass={}&sid={}'.format(self.base_url, self.username, self.password,
                                                                            self._parse_session_id(self._session_info))
        self._session_info = get_json(login_url)
424433
def login(email, password, opts = {})
      ensure_ready!
      opts = opts.merge(:email => email, :password => password)
      checked_response_body(connection.post('login', opts))
    end
1284967
def login(self, username, password):
        
        url = get_url("/login.action", scheme="https")
        params = {
            'username': username,
            'password': password,
            'submit-login': '',
        }
        with contextlib.closing(self.opener.open(url, urllib.parse.urlencode(params))) as response:
            if not "loginAction.jsp" in response.url:
                raise AuthenticationError("Login failed. Unexpected redirection: %s" % response.url)
            if not "resultMessage=success" in response.url:
                raise AuthenticationError("Login failed.")

        self.authenticated = True