CoolCMS API

ReCaptchaRuntime
in package

FinalYes

Decides at runtime whether front forms use reCAPTCHA, which version and with which keys.

Order of authority:

  1. security.reCaptcha: false in config is a hard off switch (localhost — Google does not support it; the shared dev database must not be able to turn it on).
  2. The enabled recaptcha_v3 connection with its own keys → v3 (score based).
  3. Otherwise the enabled recaptcha_v2 connection with its stored keys.

Keys live only in the connections (administration → third-party connections); config carries none. A connection without both keys is off — a widget without a site key, or a check without a secret, would only block every form.

v2 and v3 are alternatives (connection group captcha); the administration keeps only one of them enabled.

Table of Contents

Constants

VERSION_V2  : string = 'v2'
VERSION_V3  : string = 'v3'

Properties

$connections  : ExternalConnections
$securityConfig  : SecurityConfig

Methods

__construct()  : mixed
getMinimalScore()  : float
Score threshold for v3; 0 (= no threshold) for v2, whose answers carry no score.
getSecretKey()  : string
getSiteKey()  : string
getVersion()  : string
isEnabled()  : bool
isV3()  : bool
v3 runs only when its connection is enabled AND has a site key of its own.
stored()  : string|null

Constants

Properties

Methods

getMinimalScore()

Score threshold for v3; 0 (= no threshold) for v2, whose answers carry no score.

public getMinimalScore() : float
Return values
float

isV3()

v3 runs only when its connection is enabled AND has a site key of its own.

private isV3() : bool
Return values
bool

stored()

private stored(string $connection, string $field) : string|null
Parameters
$connection : string
$field : string
Return values
string|null
On this page

Search results