Login to the XMPP server as a user and set their precence to avaiable
@return boolean
354732
public function login()
    {

        //connect if not connected
        if(!$this->connected){

            $this->reconnect();
        }
        //calc the jid from uname+host
        $this->jid = $this->uname.'@'.substr($this->host, strpos($this->host, '//')+2);

        if($this->pass){

            $this->write("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>" . base64_encode("\x00" . $this->uname . "\x00" . $this->pass) . "</auth>");
        } else {
            $this->write("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='ANONYMOUS' />");
    }

        $buffer = $this->read();
        if(substr($buffer, 0, 5) == '<fail'){
            $this->onError(0, 'Cound not log in');
            return false;

        }

        $this->client_name = empty($this->client_name) ? __CLASS__ : $this->client_name;

        if(!$this->sendClientName()){
            return false;
        }

        $this->setStatus($this->status);

        $this->onAfterLogin();

        return true;

    }
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;
    }
662831
public function login() {

        if( $this->validate() ) {

			$user = $this->getUser();

			$user->lastLoginAt = DateUtil::getDateTime();

			$user->save();

            return Yii::$app->user->login( $user, false );
        }

		return false;
    }
1080855
public function isLoggedIn() : bool {

		// Requires a started session
		if (isset($_SESSION["login_token"])) {
			$loginToken = $_SESSION["login_token"];
			return $this->sessionManager->isValidLoginToken($loginToken);
		} else {
			return false;
		}
	}
1245475
public function isLogined()
    {
        $session = $this->getSession();
        $cookie = $this->getCookie();

        if ($cookie->has(self::USER_SESSION)) {
            $login = $cookie->get(self::USER_SESSION);
            $login = unserialize(base64_decode($login));
        }elseif (false !== $session->has(self::USER_SESSION)) {
            $login = $session->get(self::USER_SESSION);
        }else{
            return false;
        }

        return $this->isSameIp($login);
    }
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']
                )
            );
        }
    }
84926
public function auth()
    {
        $user     = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : null;
        $password = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : null;

        if (is_null($user) || !(bool) call_user_func($this->verify, $user, $password)) {
            header(sprintf('WWW-Authenticate: Basic realm="%s"', $this->realm));
            header('HTTP/1.0 401 Unauthorized');

            if ($this->deny) {
                call_user_func($this->deny, $user);
            }

            exit;
        }

        $this->user     = $user;
        $this->password = $password;

        return $this;
    }
826730
public function login($user = 'anonymous', $pass = 'jftp@joomla.org')
	{
		// If native FTP support is enabled let's use it...
		if (FTP_NATIVE)
		{
			if (@ftp_login($this->conn, $user, $pass) === false)
			{
				Log::add('JFTP::login: Unable to login', Log::WARNING, 'jerror');

				return false;
			}

			return true;
		}

		// Send the username
		if (!$this->_putCmd('USER ' . $user, array(331, 503)))
		{
			Log::add(
				sprintf('%1$s: Bad Username. Server response: %2$s [Expected: 331]. Username sent: %3$s', __METHOD__, $this->response, $user),
				Log::WARNING, 'jerror'
			);

			return false;
		}

		// If we are already logged in, continue :)
		if ($this->_responseCode == 503)
		{
			return true;
		}

		// Send the password
		if (!$this->_putCmd('PASS ' . $pass, 230))
		{
			Log::add(sprintf('%1$s: Bad Password. Server response: %2$s [Expected: 230].', __METHOD__, $this->response), Log::WARNING, 'jerror');

			return false;
		}

		return true;
	}
977843
public function login()
    {
        if ($this->validate()) {
            return Podium::getInstance()->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
        }
        return false;
    }
541227
private function login(){
        extract($this->config);
        $this->link = ftp_connect($host, $port, $timeout);
        if($this->link) {
            if (ftp_login($this->link, $username, $password)) {
               return true;
            } else {
                $this->error = "无法登录到FTP服务器：username - {$username}";
            }
        } else {
            $this->error = "无法连接到FTP服务器：{$host}";
        }
        return false;
    }
584404
public function login()
    {

        // invoke the parent method
        if (parent::login()) {
            // if login has been successfully, setup our view of the user
            $name = new String($this->sharedState->get(SharedStateKeys::LOGIN_NAME));
            // query whether or not we alredy hava a principal
            if ($name instanceof PrincipalInterface) {
                $this->identity = name;
            } else {
                $name = $name->__toString();
                try {
                    $this->identity = $this->createIdentity($name);
                } catch (\Exception $e) {
                    throw new LoginException(sprintf('Failed to create principal: %s', $e->getMessage()));
                }
            }

            // return immediately
            return true;
        }

        // else, reset the login flag
        $this->loginOk = false;

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

        if ($name == null && $password == null) {
            $this->identity = $this->unauthenticatedIdentity;
        }

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

            // hash the user entered password if password hashing is in use
            if ($this->hashAlgorithm != null) {
                $password = $this->createPasswordHash($name, $password);
                // validate the password supplied by the subclass
                $expectedPassword = $this->getUsersPassword();
            }

            // validate the password
            if ($this->validatePassword($password, $expectedPassword) === false) {
                throw new FailedLoginException('Password Incorrect/Password Required');
            }
        }

        // 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, $name);
            $this->sharedState->add(SharedStateKeys::LOGIN_PASSWORD, $this->credential);
        }

        $this->loginOk = true;
        return true;
    }
114078
protected function _init() {
		parent::_init();
		$this->_rules += [
			'allowAll' => [
				'rule' => function() {
					return true;
				}
			],
			'denyAll' => [
				'rule' => function() {
					return false;
				}
			],
			'allowAnyUser' => [
				'message' => 'You must be logged in.',
				'rule' => function($user) {
					return $user ? true : false;
				}
			],
			'allowIp' => [
				'message' => 'Your IP is not allowed to access this area.',
				'rule' => function($user, $request, $options) {
					$options += ['ip' => false];
					if (is_string($options['ip']) && strpos($options['ip'], '/') === 0) {
						return (boolean) preg_match($options['ip'], $request->env('REMOTE_ADDR'));
					}
					if (is_array($options['ip'])) {
						return in_array($request->env('REMOTE_ADDR'), $options['ip']);
					}
					return $request->env('REMOTE_ADDR') === $options['ip'];
				}
			]
		];
	}
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.");
    }
  }
1359698
public function doLogin()
  {
      if ($this->parent->isLoggedIn()) {
          return true;
      }

      $this->parent->writer->resetKey();
      $this->parent->reader->resetKey();
      $resource = Constants::PLATFORM.'-'.Constants::WHATSAPP_VER;
      $data = $this->parent->writer->StartStream(Constants::WHATSAPP_SERVER, $resource);
      $feat = $this->createFeaturesNode();
      $auth = $this->createAuthNode();
      $this->parent->sendData($data);
      $this->parent->sendNode($feat);
      $this->parent->sendNode($auth);

      $this->parent->pollMessage();
      $this->parent->pollMessage();
      $this->parent->pollMessage();

      if ($this->parent->getChallengeData() != null) {
          $data = $this->createAuthResponseNode();
          $this->parent->sendNode($data);
          $this->parent->reader->setKey($this->inputKey);
          $this->parent->writer->setKey($this->outputKey);
          while (!$this->parent->pollMessage()) {
          };
      }

      if ($this->parent->getLoginStatus() === Constants::DISCONNECTED_STATUS) {
          throw new LoginFailureException();
      }

      $this->parent->logFile('info', '{number} successfully logged in', ['number' => $this->phoneNumber]);
      $this->parent->sendAvailableForChat();
      $this->parent->sendGetPrivacyBlockedList();
      $this->parent->sendGetClientConfig();
      $this->parent->setMessageId(substr(bin2hex(mcrypt_create_iv(64, MCRYPT_DEV_URANDOM)), 0, 22)); // 11 char hex

      if (extension_loaded('curve25519') || extension_loaded('protobuf')) {
          if (file_exists($this->parent->dataFolder.'axolotl-'.$this->phoneNumber.'.db')) {
              $pre_keys = $this->parent->getAxolotlStore()->loadPreKeys();
              if (empty($pre_keys)) {
                  $this->parent->sendSetPreKeys();
                  $this->parent->logFile('info', 'Sending prekeys to WA server');
              }
          }
      }

      return true;
  }
237758
private function remoteLogin()
    {
        $ftp_login = true;
        $connet = ftp_connect($this->host, $this->port);
        $login = ftp_login($connet, $this->user, $this->pwd);
        if (!$connet || $login) {
            $this->tips = 'connet';
            $ftp_login = false;
        }
        $this->link = $connet;
        ftp_pasv($this->link, true);
        return $ftp_login;
    }
267891
public function login()
    {
        // TODO: Implement run() method.
        if (isset($_GET['logout'])) {
            $this->addMessage('Se ha desconectado correctamente');
            Session::delete($this->session_key);
            setcookie($this->session_key, '', 0, '/');
            $this->user = new User();
        }
        if ($this->requireLogin) {
            if (!Session::has($this->session_key)) {
                if (strpos(Server::get('REQUEST_URI'), '/login') === false) {
                    if (!isset($_GET['logout'])) {
                        $this->addMessage($this->reasonMessage, 'warning');
                    }
                    if (!isset($_GET['logout'])) {
                        Session::set('return', get_request_url());
                    }
                    $auth = "";
                    if (isset($_GET['auth'])) {
                        $auth = "?auth=" . $_GET['auth'];
                    }
                    $this->quit($this->config['app']['basepath'] . '/login' . $auth);
                    return false;
                }
            }
        }
        return true;
    }
940272
protected function login()
    {
        // Perform a request with the login credentials in the request header.
        $response = $this->client->get('services/login', [
            'headers' => ['username'=> $this->username, 'password' => $this->password],
        ]);

        // Parse the response body.
        $json = json_decode($response->getBody());
        $body = $json->{'nl.divide.iq'};
        $expire = new \DateTime($body->expiration_date, new \DateTimezone('UTC'));

        // Store the authentication token in the object.
        $this->authToken = new Token($body->authentication_token, $expire);

        return $this;
    }