Login to server using username and password.

@return bool

@throws SshLoginException
165373
private function loginWithPassword()
    {
        $password = $this->sshConfig['password'];
        if (!is_string($password)) {
            $password = $this->askForPassword(
                sprintf(
                    'Password for %s@%s:%s: ',
                    $this->sshConfig['username'],
                    $this->sshConfig['host'],
                    $this->sshConfig['port']
                )
            );
        }

        if (!$this->ssh->login($this->sshConfig['username'], $password)) {
            throw new SshLoginException($this->name);
        }

        return true;
    }
788754
public function login($username = null, $password = null)
    {
        $this->_username = null !== $username ? $username : $this->_username;
        $this->_password = null !== $password ? $password : $this->_password;

        if (null === $this->_ssh_resource) {
            throw new TransportException(sprintf('None SSH connection available.'));
        }

        if (null === $this->_ssh_key_pub) {
            if (false === ssh2_auth_password($this->_ssh_resource, $this->_username, $this->_password)) {
                throw new TransportException(sprintf('Could not authenticate with username %s.', $this->_username));
            }
        } else {
            if (false === ssh2_auth_pubkey_file($this->_ssh_resource, $this->_username, $this->_ssh_key_pub, $this->_ssh_key_priv, $this->_ssh_key_pass)) {
                throw new TransportException(sprintf('Could not authenticate with keyfile %s.', $this->_keyfile));
            }
        }

        if (false === $this->_sftp_resource = ssh2_sftp($this->_ssh_resource)) {
            throw new TransportException("Could not initialize SFTP subsystem.");
        }

        return $this;
    }
1370191
private function login()
    {
        ['username' => $username, 'password' => $password] = $this->config;

        // We disable error handling to avoid credentials leak :+1:
        set_error_handler(
            function () {
            }
        );

        $is_logged_in = ftp_login($this->connection, $username, $password);

        restore_error_handler();

        if (!$is_logged_in) {
            $this->disconnect();

            throw new RuntimeException(
                sprintf(
                    'Could not login with connection: (s)ftp://%s@%s:%s',
                    $username,
                    $this->config['hostname'],
                    $this->config['port']
                )
            );
        }
    }
288823
public function login()
	{
		if($this->_identity===null)
		{
			$this->_identity=new UserIdentity('yiier',$this->password);
			$this->_identity->authenticate();
		}
		if($this->_identity->errorCode===UserIdentity::ERROR_NONE)
		{
			Yii::app()->user->login($this->_identity);
			return true;
		}
		else
			return false;
	}
1054543
protected function loginWithCookie()
    {
        $username = $this->request->getCookie('login.username');
        $password = $this->request->getCookie('login.password');

        //Checks if the cookies exist
        if (!$username || !$password) {
            return;
        }

        //Tries to login
        $this->request = $this->request->withParsedBody(compact('username', 'password'));
        $user = $this->Auth->identify();
        if (!$user || !$user['active'] || $user['banned']) {
            return $this->buildLogout();
        }

        $this->Auth->setUser($user);
        $this->LoginRecorder->setConfig('user', $user['id'])->write();

        return $this->redirect($this->Auth->redirectUrl());
    }
476235
protected function doLogin() {
    if ($this->user) {
      $request = ObjectFactory::getNewInstance('request');
      $request->setAction('login');
      $request->setValues([
        'login' => $this->user['login'],
        'password' => $this->user['password']
      ]);
      $response = $this->doRemoteCall($request, true);
      if ($response->getValue('success')) {
        $this->sessionId = $response->getValue('sid');
        return true;
      }
    }
    else {
      throw new \RuntimeException("Remote user required for remote call.");
    }
  }
1284583
public function login()
    {
        // grab credentials from the request
        $credentials = Input::only('email', 'password');

        try {
            // attempt to verify the credentials and create a token for the user
            if (! $token = JWTAuth::attempt($credentials)) {
                return response()->json(arrayView('phpsoft.users::errors/authenticate', [
                    'error' => 'Invalid Credentials.'
                ]), 401);
            }
        } catch (JWTException $e) {
            // something went wrong whilst attempting to encode the token
            return response()->json(arrayView('phpsoft.users::errors/authenticate', [
                'error' => 'Could not create token.'
            ]), 500);
        }

        // all good so return the token
        return response()->json(arrayView('phpsoft.users::tokens/show', compact('token')));
    }
651283
public function logout()
    {
        if (!$this->hasSudoed()) {
            return false;
        }

        $this->auth->logout();

        $originalUserId = $this->session->get($this->sessionKey);

        if ($originalUserId) {
            $this->auth->loginUsingId($originalUserId);
        }

        $this->session->forget($this->sessionKey);
        $this->session->forget('sudosu.has_sudoed');

        return true;
    }
462061
protected function perform_login()
    {
        if (empty($this->email)) {
            $this->error = 601;
            return false;
        } elseif (empty($this->password)) {
            $this->error = 602;
            return false;
        } else {
            // Make some cookies. We all like cookies. Microsoft just likes them more.
            $this->add_cookie('.xbox.com', 'MC0', time(), '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 's_vi', '[CS]v1|26AD59C185011B4D-40000113004213F1[CE]', '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 's_nr', '1297891791797', '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 's_sess', '%20s_cc%3Dtrue%3B%20s_ria%3Dflash%252011%257Csilverlight%2520not%2520detected%3B%20s_sq%3D%3B', '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 's_pers', '%20s_vnum%3D1352674046430%2526vn%253D4%7C1352674046430%3B%20s_lastvisit%3D1324587801077%7C1419195801077%3B%20s_invisit%3Dtrue%7C1324589873289%3B', '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 'UtcOffsetMinutes', '60', '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 'xbox_info', 't=6', '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 'PersistentId', '0a652e56e40f42caac3ac84fad02ed01', '/', time() + (60*60*24*365));

            // Send the data to Xbox and retrieve the response.
            $url = 'https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=12&ct=' . time() . '&rver=6.2.6289.0&wp=MBI_SSL&wreply=https:%2F%2Faccount.xbox.com:443%2Fpassport%2FsetCookies.ashx%3Frru%3Dhttps%253a%252f%252faccount.xbox.com%252fen-US%252f&lc=1033&id=292543&cbcxt=0';
            $result = $this->fetch_url($url, 'http://www.xbox.com/en-US/');

            $this->stack_trace[] = array(
                'url'      => $url,
                'postdata' => '',
                'result'   => $result
            );

            // More cookies...
            $this->add_cookie('.login.live.com', 'WLOpt', 'act=[1]', time() + (60*60*24*365));
            $this->add_cookie('.login.live.com', 'CkTst', 'G' . time(), '/', time() + (60*60*24*365));

            // Find the right parameters. We need this data for the next request.
            $url  = $this->find($result, 'urlPost:\'', '\',');
            $PPFT = $this->find($result, 'name="PPFT" id="i0327" value="', '"');
            $PPSX = $this->find($result, 'srf_sRBlob=\'', '\';');

            // Send the data back to Xbox and retrieve the response.
            $post_data = 'login=' . $this->email . '&passwd=' . $this->password . '&KMSI=1&mest=0&type=11&LoginOptions=3&PPSX=' . $PPSX . '&PPFT=' . $PPFT . '&idsbho=1&PwdPad=&sso=&i1=1&i2=1&i3=12035&i12=1&i13=1&i14=323&i15=3762&i18=__Login_Strings%7C1%2C__Login_Core%7C1%2C';
            $result = $this->fetch_url($url, 'https://login.live.com/login.srf', null, $post_data);

            $this->stack_trace[] = array(
                'url'       => $url,
                'post_data' => $post_data,
                'result'    => $result
            );

            // MOAR COOKIESSSSSSSS!!!
            $this->add_cookie('.live.com', 'wlidperf', 'throughput=3&latency=961&FR=L&ST=1297790188859', '/', time() + (60*60*24*365));
            $this->add_cookie('login.live.com', 'CkTst', time(), '/ppsecure/', time() + (60*60*24*365));

            $url  = $this->find($result, 'id="fmHF" action="', '"');
            $NAP  = $this->find($result, 'id="NAP" value="', '"');
            $ANON = $this->find($result, 'id="ANON" value="', '"');
            $t    = $this->find($result, 'id="t" value="', '"');

            $this->add_cookie('.xbox.com', 'ANON', $ANON, '/', time() + (60*60*24*365));
            $this->add_cookie('.xbox.com', 'NAP', $NAP, '/', time() + (60*60*24*365));

            // OK, last time we send data to Xbox and retrieve the response.
            $post_data = 'NAPExp=' . date('c', mktime(date('H'), date('i'), date('s'), date('n') + 1)) . '&NAP=' . $NAP . '&ANONExp=' . date('c', mktime(date('H'), date('i'), date('s'), date('n') + 1)) . '&ANON=' . $ANON . '&t=' . $t;
            $result = $this->fetch_url($url, '', 16, $post_data);

            $this->stack_trace[] = array(
                'url'       => $url,
                'post_data' => $post_data,
                'result'    => $result
            );

            $result = $this->fetch_url('https://account.xbox.com/en-US/social');

            // Make sure we got signed in...
            if (stripos($result, '<h3 class="feedSectionTitle">Activity feed</h3>') !== false) {
                $this->logged_in = true;
                return true;
            } else {
                $this->error = 600;
                $this->save_stack_trace();
                return false;
            }
			
        }
    }
640282
protected function login()
    {
        if ($this->_auth) {
            return $this->_auth;
        }

        $writeBinn= new BinnList;

        $writeBinn->addInt16(self::DAEMON_SERVER_MODE_AUTH);
        $writeBinn->addStr($this->username);
        $writeBinn->addStr($this->password);
        $writeBinn->addInt16($this->mode);

        $read = $this->writeAndReadSocket($writeBinn->serialize());

        $readBinn = new BinnList;
        $readBinn->binnOpen($read);
        $results = $readBinn->unserialize();

        if ($results[0] == self::STATUS_OK) {
            $this->_auth = true;
        } else {
            throw new RuntimeException('Could not login with connection: ' . $this->host . ':' . $this->port
                . ', username: ' . $this->username);
        }

        return $this->_auth;
    }
2501
public function login()
    {
        $response = $this->request(self::METHOD_POST, '/user/login', [
            'appkey' => $this->parameters->getAuth('appkey'),
            'email' => $this->parameters->getAuth('email'),
            'password' => $this->parameters->getAuth('password'),
            'hash' => $this->parameters->getAuth('hash'),
        ]);

        if (isset($response['apikey'])) {
            $this->apikey = $response['apikey'];
        }

        return $response;
    }
976102
public function login()
    {
        if ($this->validate()) {
            UserLoginHistory::createAsync(['user_id' => $this->user->getId(), 'ip' => Yii::$app->request->userIP]);
            return Yii::$app->user->login($this->user, $this->rememberMe ? Yii::$app->settings->get('rememberFor', 'user') : 0);
        } else {
            return false;
        }
    }
685160
public function login() {
        $state = Str::randomNumber(7);
        Factory::session()->set('state', $state);
        $this->set('state', $state);
        return $this->getLogin()->getUrl();
    }
549524
public function loginSuccess()
    {
        $this->userID = (int) $this->kontakt->getMyKey();
        $this->setUserLogin($this->kontakt->getDataValue($this->loginColumn));
        $this->logged = true;
        $this->addStatusMessage(sprintf(_('Sign in %s all ok'), $this->userLogin),
            'success');

        return true;
    }
197625
public function doLogin()
    {
        $remember = Input::post('remember', false);
        $email    = Input::post('email');
        $redirect = Input::post('redirect');
        $redirect = ($redirect) ? $redirect : 'admin';

        try{
            $credential = array(
                'email'     => $email,
                'password'  => Input::post('password')
            );

            // Try to authenticate the user
            $user = Sentry::authenticate($credential, false);

            if($remember){
                Sentry::loginAndRemember($user);
            }else{
                Sentry::login($user, false);
            }

            Response::redirect($this->siteUrl($redirect));
        }catch(\Exception $e){
            App::flash('message', $e->getMessage());
            App::flash('email', $email);
            App::flash('redirect', $redirect);
            App::flash('remember', $remember);

            Response::redirect($this->siteUrl('login'));
        }
    }
1338689
public function login(string $username, string $password)
    {
        $this->userInfo = $this->makeRequest('POST', 'login', compact('username', 'password'));

        if (!isset($this->userInfo['error']) && isset($this->userInfo['data']['id'])) {
            return true;
        }

        return false;
    }
1314446
public function authenticate()
	{
		$user=User::model()->find('LOWER(username)=?',array(strtolower($this->username)));
		if($user===null)
			$this->errorCode=self::ERROR_USERNAME_INVALID;
		else if(!$user->validatePassword($this->password))
			$this->errorCode=self::ERROR_PASSWORD_INVALID;
		else
		{
			$this->_id=$user->id;
			$this->username=$user->username;
			$this->errorCode=self::ERROR_NONE;
		}
		return $this->errorCode==self::ERROR_NONE;
	}