Class RecaptchaComponent
Represents a reCAPTCHA form component.
public class RecaptchaComponent : FormComponent<RecaptchaProperties, string>
- Inheritance
-
objectRecaptchaComponent
- Inherited Members
- Extension Methods
Constructors
RecaptchaComponent(IAppSettingsService, IHttpContextAccessor, ILocalizationService, IWebsiteChannelContext, IInfoProvider<WebsiteCaptchaSettingsInfo>)
Initializes a new instance of RecaptchaComponent
public RecaptchaComponent(IAppSettingsService appSettingsService, IHttpContextAccessor httpContextAccessor, ILocalizationService localizationService, IWebsiteChannelContext websiteChannelContext, IInfoProvider<WebsiteCaptchaSettingsInfo> captchaSettingInfoProvider)
Parameters
appSettingsService
IAppSettingsServicehttpContextAccessor
IHttpContextAccessorlocalizationService
ILocalizationServicewebsiteChannelContext
IWebsiteChannelContextcaptchaSettingInfoProvider
IInfoProvider<WebsiteCaptchaSettingsInfo>
Fields
IDENTIFIER
Represents the RecaptchaComponent identifier.
public const string IDENTIFIER = "Kentico.Recaptcha"
Field Value
- string
Properties
IsConfigured
Determines whether the component is configured and allowed to be displayed.
public bool IsConfigured { get; }
Property Value
- bool
IsV3
Indicates whether or not the component is configured to use reCAPTCHA V3.
public bool IsV3 { get; }
Property Value
- bool
LabelForPropertyName
Label "for" cannot be used for this component.
public override string LabelForPropertyName { get; }
Property Value
- string
Language
Optional. Forces the reCAPTCHA to render in a specific language. Auto-detects the user's language if unspecified. Currently supported values are listed at https://developers.google.com/recaptcha/docs/language.
public string Language { get; set; }
Property Value
- string
PrivateKey
reCAPTCHA V2 private key from https://www.google.com/recaptcha/admin.
public string PrivateKey { get; set; }
Property Value
- string
PrivateKeyV3
reCAPTCHA v3 private key from https://www.google.com/recaptcha/admin.
public string PrivateKeyV3 { get; set; }
Property Value
- string
PublicKey
reCAPTCHA V2 site key from https://www.google.com/recaptcha/admin.
public string PublicKey { get; set; }
Property Value
- string
PublicKeyV3
reCAPTCHA v3 site key from https://www.google.com/recaptcha/admin.
public string PublicKeyV3 { get; set; }
Property Value
- string
Value
Holds nothing and is here just because it is required.
public string Value { get; set; }
Property Value
- string
Methods
GetValue()
Returns empty string since the Value does not hold anything.
public override string GetValue()
Returns
- string
Returns the value of the form component.
LoadProperties(FormComponentProperties)
Loads properties of the form component. The actual properties
type must match the PropertiesType.
public override void LoadProperties(FormComponentProperties properties)
Parameters
properties
FormComponentPropertiesForm component properties to be loaded.
Exceptions
- ArgumentNullException
Thrown when
properties
are null.- ArgumentException
Thrown when
properties
do not match the PropertiesType.
SetValue(string)
Does nothing since the Value does not need to hold anything.
public override void SetValue(string value)
Parameters
value
stringValue to be set.
Validate(ValidationContext)
Performs validation of the reCAPTCHA component.
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
Parameters
validationContext
ValidationContextThe validation context.
Returns
- IEnumerable<ValidationResult>
A collection that holds failed-validation information.