Get the login captcha.

@param string $codePath

@return string
773540
public function getCaptcha($path)
    {
        $url = Config::get('url.login_captcha');
        $cookie = new CookieJar();
        $codePath = $path . sha1($this->getUsername() . '-' . microtime(true)) . '.gif';
        $options = ['cookies' => $cookie, 'save_to' => $codePath];

        $response = $this->request('get', [$url, [], $options]);

        // Check the StatusCode
        if ($response->getStatusCode() == 200) {
            throw new HttpException('get the captcha failed!', 10005);
        }

        return $codePath;
    }
595586
protected function getNextToken()
    {
        return $this->getDeferredToken()
            ?: $this->scanEOS()
            ?: $this->scanLanguage()
            ?: $this->scanComment()
            ?: $this->scanPyStringOp()
            ?: $this->scanPyStringContent()
            ?: $this->scanStep()
            ?: $this->scanScenario()
            ?: $this->scanBackground()
            ?: $this->scanOutline()
            ?: $this->scanExamples()
            ?: $this->scanFeature()
            ?: $this->scanTags()
            ?: $this->scanTableRow()
            ?: $this->scanNewline()
            ?: $this->scanText();
    }
953860
def _get_captcha(reddit_session, captcha_id):
    """"""
    url = urljoin(reddit_session.config['captcha'],
                  captcha_id + '.png')
    sys.stdout.write('Captcha URL: {0}\nCaptcha: '.format(url))
    sys.stdout.flush()
    raw = sys.stdin.readline()
    if not raw:  # stdin has reached the end of file
        # Trigger exception raising next time through. The request is
        # cached so this will not require and extra request and delay.
        sys.stdin.close()
        return None
    return {'iden': captcha_id, 'captcha': raw.strip()}
948704
protected function _getAuth($path = null) {
		if ($this->getConfig('autoClearCache') && Configure::read('debug')) {
			Cache::delete($this->getConfig('allowCacheKey'), $this->getConfig('cache'));
		}
		$roles = Cache::read($this->getConfig('allowCacheKey'), $this->getConfig('cache'));
		if ($roles !== false) {
			return $roles;
		}

		if ($path === null) {
			$path = $this->getConfig('allowFilePath');
		}
		$iniArray = $this->_parseFiles($path, $this->getConfig('allowFile'));

		$res = [];
		foreach ($iniArray as $key => $actions) {
			$res[$key] = $this->_deconstructIniKey($key);
			$res[$key]['map'] = $actions;

			$actions = explode(',', $actions);

			if (in_array('*', $actions)) {
				$res[$key]['actions'] = [];
				continue;
			}

			foreach ($actions as $action) {
				$action = trim($action);
				if (!$action) {
					continue;
				}

				$res[$key]['actions'][] = $action;
			}
		}

		Cache::write($this->getConfig('allowCacheKey'), $res, $this->getConfig('cache'));
		return $res;
	}
14160
public function searchAttribute(string ...$searchPath): string
    {
        $attribute = array_pop($searchPath);
        $node = $this->searchNode(...$searchPath);
        return (null !== $node) ? $node[$attribute] : '';
    }
385317
private function getCaptchaImage()
    {
        $image = $this->client->get(self::URL_CAPTCHA);

        if (false === $image) {
            $this->error = 'No se pudo cargar el captcha image';

            return false;
        }

        return $image;
    }
729996
public function get($code)
    {
        foreach ($this->getDbConnection()->fetchAll(
            'SELECT * from oauth_auth_code
            WHERE auth_code = :authCode AND expire_time > :ts',
            [
                'authCode' => $code,
                'ts' => time()
            ]
        ) as $row) {
            if ($row) {
                return (new AuthCodeEntity($this->server))
                    ->setRedirectUri($row['client_redirect_uri'])
                    ->setExpireTime($row['expire_time'])
                    ->setId($row['auth_code']);
            }
        }
        return null;
    }
1121983
protected function findValueToMatch($requestPath)
    {
        if ($this->splitString !== '') {
            $splitStringPosition = strpos($requestPath, $this->splitString);
            if ($splitStringPosition !== false) {
                return substr($requestPath, 0, $splitStringPosition);
            }
        }

        return $requestPath;
    }
932989
protected function GenerateCaptcha()
    {
        $sCaptchaQuestion = false;
        if ($this->NeedCaptcha()) {
            $num1 = rand(1, 10);
            $num2 = rand(1, 10);
            $val = $num1 + $num2;
            $_SESSION[self::SESSION_CAPTCHA] = $val;
            $sCaptchaQuestion = ('Was ergibt '.$num1.' + '.$num2.' ?');
        }

        return $sCaptchaQuestion;
    }
1007792
private function _getCode(){
        $code = null;
        //try{
            $text = $this->text;
            $textColor = new CINColor($this->foregroundColor);
            $backgroudColor = new CINColor($this->backgroundColor);
            $fontPath = isset($this->font) ? $this->font : $this->_getDefaultFont();

            $font = new CINFontFile($fontPath, (is_int($this->fontSize)) ? $this->fontSize : 18);

            $codeClass = "\\CodeItNow\\BarcodeBundle\\Generator\\".$this->barcodeType;
            $code = new $codeClass();
            if($this->scale){
                $code->setScale($this->scale); // Resolution
            }
            if($this->thickness){
                $code->setThickness($this->thickness); // Thickness
            }
            if($this->label !== FALSE){
                $code->setLabel($this->label);
            }
            if($this->noLengthLimit){
                $code->setNoLengthLimit($this->noLengthLimit);
            }
            if($this->allowsUnknownIdentifier){
                $code->setAllowsUnknownIdentifier($this->allowsUnknownIdentifier);
            }
            $code->setForegroundColor($textColor); // Color of bars
            $code->setBackgroundColor($backgroudColor); // Color of spaces
            $code->setFont($font); // Font (or 0)
            $code->parse($text); // Text
        //} catch (\Exception $ex) {
            
        //}
        return $code;
    }
882720
public function recaptchaSecretKey()
    {
        $recaptcha = $this->apiConfig('google.recaptcha');

        if (!empty($recaptcha['private_key'])) {
            return $recaptcha['private_key'];
        } elseif (!empty($recaptcha['secret'])) {
            return $recaptcha['secret'];
        }

        return null;
    }
799051
public static function getCfg($path = array())
    {
        if (isset(self::$htmlentitiesMore[140])) {
            foreach (self::$htmlentitiesMore as $k => $v) {
                unset(self::$htmlentitiesMore[$k]);
                self::$htmlentitiesMore[chr($k)] = $v;
            }
        }
        return parent::getCfg($path);
    }
42288
public function login($appKey, $username, $password)
    {
        self::$appKey = $appKey;

        $request = $this->httpClient
            ->setMethod('post')
            ->setEndPoint(self::ENDPOINT.'login/')
            ->setFormData([ 'username' => $username, 'password' => $password ]);

        $result = $this->execute($request);

        self::$sessionToken = $result->token;
        self::$lastLogin = time();

        return $result->token;
    }
623558
protected function getScriptText()
    {
        $login = Builder::escapeText($this->login);

        if ($this->control) {
            // Control event
            $controlId = Builder::escapeText($this->control->getId());
            return "
if (Event.Control.ControlId == {$controlId}) {
	ShowProfile({$login});
}";
        }

        // Other events
        return "
ShowProfile({$login});";
    }
440325
private function getKeyValueFromConsul(string $kvPath): string
    {
        return $this->kv->get($kvPath, ['raw' => true])->getBody();
    }
287957
public function getComputedMask($resourceType, $folderPath)
    {
        $_computedMask = 0;

        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
        $_roleSessionVar = $_config->getRoleSessionVar();

        $_userRole = null;
        if (strlen($_roleSessionVar) && isset($_SESSION[$_roleSessionVar])) {
            $_userRole = (string)$_SESSION[$_roleSessionVar];
        }
        if (!is_null($_userRole) && !strlen($_userRole)) {
            $_userRole = null;
        }

        $folderPath = trim($folderPath, "/");
        $_pathParts = explode("/", $folderPath);

        $_currentPath = "/";

        for($i = -1; $i < sizeof($_pathParts); $i++) {
            if ($i >= 0) {
                if (!strlen($_pathParts[$i])) {
                    continue;
                }

                if (array_key_exists($_currentPath . '*/', $this->_aclEntries))
                $_computedMask = $this->mergePathComputedMask( $_computedMask, $resourceType, $_userRole, $_currentPath . '*/' );

                $_currentPath .= $_pathParts[$i] . '/';
            }

            if (array_key_exists($_currentPath, $this->_aclEntries)) {
                $_computedMask = $this->mergePathComputedMask( $_computedMask, $resourceType, $_userRole, $_currentPath );
            }
        }

        return $_computedMask;
    }
1032965
def protect_login_with_captcha(func):
    
    @wraps(func)
    def decorated_login(request, *args, **kwargs):
        response = func(request, *args, **kwargs)

        access_attempt = AccessAttempt(request, response)
        access_attempt.inspect()

        return response

    return decorated_login