Check if the query parameters contain information about a
valid Telegram login request.

@return bool
196185
protected function isValidLoginRequest()
    {
        $check_hash = $this->queryParameters->get('hash');

        // Get sorted array of values
        $check = $this->queryParameters
            ->except('hash')
            ->map(function ($value, $key) {
                return $key.'='.$value;
            })
            ->values()
            ->sort();
        $check_string = implode("\n", $check->toArray());

        $secret = hash('sha256', $this->config->get('token'), true);
        $hash = hash_hmac('sha256', $check_string, $secret);

        if (strcmp($hash, $check_hash) !== 0) {
            return false;
        }
        if ((time() - $this->queryParameters->get('auth_date')) > 86400) {
            return false;
        }

        return true;
    }
835032
protected function verifyRequest() : bool
    {
        if (!$this->request->has('g-recaptcha-response')) {
            $this->redirectMessage = 'Recaptcha was not completed';

            return false;
        }

        $data = $this->getRecaptchaResult();

        $success = isset($data->success) ? (bool) $data->success : false;

        if ($success) {
            return true;
        }

        $this->redirectMessage = 'Recaptcha was invalid';

        return false;
    }
110499
protected function checkLogin()
    {
        $pass = $this->doc->__get("password");
        if($pass){
            if(session('pass') === md5($pass)){
                return true;
            }else{
                return false;
            }
        }else{
            return true;
        }
    }
39069
protected function verifySendParams() {
        $m = ' must be set in order to send transport content!';
        //common requirements
        if (!array_key_exists('ShipmentId', $this->options)) {
            $this->log('Shipment ID'.$m, 'Warning');
            return false;
        }
        if (!array_key_exists('IsPartnered', $this->options)) {
            $this->log('IsPartnered'.$m, 'Warning');
            return false;
        }
        if (!array_key_exists('ShipmentType', $this->options)) {
            $this->log('Shipment type'.$m, 'Warning');
            return false;
        }
        //requirements based on partnership and type
        $p = $this->options['IsPartnered'] == 'true';
        $sp = $this->options['ShipmentType'] == 'SP';
        $ltl = $this->options['ShipmentType'] == 'LTL';
        //options could be in four possible places, so a search is needed
        $foundCarrier = false;
        $foundPackages = false;
        $foundPro = false;
        $foundContact = false;
        $foundBoxCount = false;
        $foundReady = false;
        foreach ($this->options as $op=>$junk) {
            if(preg_match("#CarrierName#",$op)){
                $foundCarrier = true;
            }
            if(preg_match("#PackageList\.member\.1#",$op)){
                $foundPackages = true;
            }
            if(preg_match("#ProNumber#",$op)){
                $foundPro = true;
            }
            if(preg_match("#Contact\.Name#",$op)){
                $foundContact = true;
            }
            if(preg_match("#BoxCount#",$op)){
                $foundBoxCount = true;
            }
            if(preg_match("#FreightReadyDate#",$op)){
                $foundReady = true;
            }
        }
        if (!$p && !$foundCarrier) {
            $this->log('Carrier'.$m, 'Warning');
            return false;
        }
        if ($sp && !$foundPackages) {
            $this->log('Packages'.$m, 'Warning');
            return false;
        }
        if (!$p && $ltl && !$foundPro) {
            $this->log('PRO number'.$m, 'Warning');
            return false;
        }
        if ($p && $ltl && !$foundContact) {
            $this->log('Contact info'.$m, 'Warning');
            return false;
        }
        if ($p && $ltl && !$foundBoxCount) {
            $this->log('Box count'.$m, 'Warning');
            return false;
        }
        if ($p && $ltl && !$foundReady) {
            $this->log('Ready date'.$m, 'Warning');
            return false;
        }

        //all good
        return true;
    }
151066
protected function checkSecurity()
    {
        if (!$this->levelSecure || $this->levelSecure === self::BOTH) {
            return true;
        }

        $secure = Request::is('secure');

        return ($this->levelSecure === self::SECURE && $secure) ||
               ($this->levelSecure === self::NONSECURE && !$secure);
    }
1263557
public function checkPassword(): bool
    {
        if (!isset($this->regex)) {
            return true;
        }

        return filter_var($this->password, FILTER_VALIDATE_REGEXP, [
            'options' => [
                'regexp' => $this->regex
            ]
        ]);
    }
827669
public function verify()
    {
        if (!$this->_config['enable']) {
            return true;
        }

        $controller = $this->_registry->getController();
        if ($controller->request->getData('g-recaptcha-response')) {
            $response = json_decode($this->apiCall());

            if (isset($response->success)) {
                return $response->success;
            }
        }

        return false;
    }
673310
public function isRequestSecured()
    {
        $remoteAddress = $this->server()->remoteAddress();

        $protocol = $this->server()->serverProtocol();
        $fwdProto = $this->server()->get($this->getTrustedHeaders()['client_proto']);
        if ($fwdProto && $fwdProto != '' && in_array($remoteAddress, $this->getTrustedProxies())) {
            $protocol = $fwdProto;
        }
        $protocol = strtolower($protocol);

        $isSecured = in_array($protocol, [
                'https',
                'on',
                '1'
            ]);

        if (!$isSecured) {
            if (in_array(strtolower($this->server()->https()), [
                    'https',
                    'on',
                    '1'
                ])) {
                $isSecured = true;
            }
        }

        return $isSecured;
    }
45823
public function is_authenticated() {
		$retval = false;
		$parentRes = false;
		
		try {
			if(parent::is_authenticated()) {
				$parentRes = true;
				$retval = $this->is_valid_sid($this->sid);
			}
		}
		catch(Exception $e) {
			$this->exception_handler($e->getMessage());
		}
		
		return ($retval);
	}
639813
public function sure()
    {
        return !(substr($this->args[0], 0, 4) == 'http'
            || substr($this->args[0], 0, 3) == '../'
            || substr($this->args[0], 0, 3) == '\./'
            || substr($this->args[0], 0, 2) == './'
            || substr($this->args[0], 0, 1) == '/'
        );
    }
310005
public function isValid()
    {
        $query = [
            'access_token' => $this['access_token'],
            'openid' => $this['openid'],
        ];

        $response = Http::request('GET', static::IS_VALID)
            ->withQuery($query)
            ->send();

        return 'ok' === $response['errmsg'];
    }
124264
public function isValid(): bool {
		return ($this->loginContext->hasCurrentUser()
				&& $this->loginContext->getCurrentUser()->isAdmin()) || N2N::isDevelopmentModeOn();
	}
595055
public function isValid()
	{
		if ($this->isEmpty()) {
			return false;
		}
		$requiresHost = ! $this->port->isEmpty() || ! $this->credentials->isEmpty() || $this->scheme->equals('http') || $this->scheme->equals('https');
		if ($requiresHost && $this->host->isEmpty()) {
			return false;
		}
		$requiresPath = (! $this->query->isEmpty() || ! $this->fragment->isEmpty()) && (! $this->scheme->isEmpty() || ! $this->host->isEmpty() || ! $this->port->isEmpty() || ! $this->credentials->isEmpty());
		if ($requiresPath && $this->path->isEmpty()) {
			return false;
		}
		return true;
	}
449359
protected function validSession(): bool
    {
        if (
            !array_key_exists(self::CLIENT_SIGNATURE, $_SESSION)
            || !array_key_exists(self::SESSION_CREATED, $_SESSION)
        ) {
            //Missing session signature or timestamp!
            return false;
        }

        if ($_SESSION[self::SESSION_CREATED] < time() - $this->lifetime) {
            //Session expired
            return false;
        }

        if (!hash_equals($_SESSION[self::CLIENT_SIGNATURE], $this->clientSignature)) {
            //Signatures do not match
            return false;
        }

        return true;
    }
1195963
public function isValid() {
		$this->apiTokens = $this->_loadApiTokens ();
		$key = $this->_getHeaderToken ();
		if ($this->apiTokens->isExpired ( $key )) {
			return false;
		} else {
			$this->_addHeaderToken ( $key );
			return true;
		}
	}
53917
public function isValid()
	{
	  	// Skip without submission
		if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'POST') {

			return FALSE;

		} else {

			$captchaChallenge = isset($_POST['recaptcha_challenge_field'])
				? $this->_sanitizeField($_POST['recaptcha_challenge_field'])
				: NULL;

			$captchaResponse  = isset($_POST['recaptcha_response_field'])
				? $this->_sanitizeField($_POST['recaptcha_response_field'])
				: NULL;
		 	// Skip empty submission
			if ( strlen($captchaChallenge) == 0 || strlen($captchaResponse) == 0 ) {
				$this->setError('incorrect-captcha-sol');
				return FALSE;
			}

			$data = array(
				'privatekey' => $this->_privateKey,
				'remoteip'   => $this->_remoteIp(),
				'challenge'  => $captchaChallenge,
				'response'   => $captchaResponse
				);

			$result = $this->_postHttpChallenge($data);

			if ( $result['isvalid'] === "true") {
				return TRUE;

			} else {
				$this->setError($result['error']);
			}
			return FALSE;
		}
	}
854434
protected function hasNecessaryVerifier()
    {
        $query = $this->request->getQueryParams();
        $hasToken = A::get($query, 'oauth_token') !== null;
        $hasVerifier = A::get($query, 'oauth_verifier') !== null;

        return $hasToken && $hasVerifier;
    }