ReCaptchaRuntime
in package
FinalYes
Decides at runtime whether front forms use reCAPTCHA, which version and with which keys.
Order of authority:
security.reCaptcha: falsein config is a hard off switch (localhost — Google does not support it; the shared dev database must not be able to turn it on).- The enabled
recaptcha_v3connection with its own keys → v3 (score based). - Otherwise the enabled
recaptcha_v2connection 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
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
VERSION_V2
public
string
VERSION_V2
= 'v2'
VERSION_V3
public
string
VERSION_V3
= 'v3'
Properties
$connections read-only
private
ExternalConnections
$connections
$securityConfig read-only
private
SecurityConfig
$securityConfig
Methods
__construct()
public
__construct(SecurityConfig $securityConfig, ExternalConnections $connections) : mixed
Parameters
- $securityConfig : SecurityConfig
- $connections : ExternalConnections
getMinimalScore()
Score threshold for v3; 0 (= no threshold) for v2, whose answers carry no score.
public
getMinimalScore() : float
Return values
floatgetSecretKey()
public
getSecretKey() : string
Return values
stringgetSiteKey()
public
getSiteKey() : string
Return values
stringgetVersion()
public
getVersion() : string
Return values
stringisEnabled()
public
isEnabled() : bool
Return values
boolisV3()
v3 runs only when its connection is enabled AND has a site key of its own.
private
isV3() : bool
Return values
boolstored()
private
stored(string $connection, string $field) : string|null
Parameters
- $connection : string
- $field : string