C# Class Evbpc.Framework.Integrations.Google.ReCaptcha.Validator

This class provides the ability to easily implement Google's reCAPTCHA.
See: https://www.google.com/recaptcha/intro/index.html
Show file Open project: EBrown8534/Framework

Public Methods

Method Description
GetBodyDivContent ( ) : string

Returns the <div> that should be inserted in the HTML where the reCAPTCHA should be rendered.

This method allows you to pass an arbitrary list of extra classes, regardless of what the current instance may contain.

Validate ( NameValueCollection form, string remoteIp = null ) : Response

Determines if the reCAPTCHA response in a NameValueCollection passed validation.

If the returned Response is null, then a severe error occurred during the exchange.

Validator ( string reCaptchaSecret, string reCaptchaSiteKey ) : System

Creates a new instance of the Validator.

Protected Methods

Method Description
GetPostParameters ( string reCaptchaFormResponse, string remoteIp = null ) : NameValueCollection

Returns the parameters to be placed within the post body of a validation message.

UploadRecaptchaResponse ( NameValueCollection postParameters ) : string

Uploads a request to the Google API for reCAPTCHA data to be validated.

Method Details

GetBodyDivContent() public method

Returns the <div> that should be inserted in the HTML where the reCAPTCHA should be rendered.
This method allows you to pass an arbitrary list of extra classes, regardless of what the current instance may contain.
public GetBodyDivContent ( ) : string
return string

GetPostParameters() protected method

Returns the parameters to be placed within the post body of a validation message.
protected GetPostParameters ( string reCaptchaFormResponse, string remoteIp = null ) : NameValueCollection
reCaptchaFormResponse string The response from the reCAPTCHA form.
remoteIp string An optional IP to include as the origin of the reCAPTCHA form.
return System.Collections.Specialized.NameValueCollection

UploadRecaptchaResponse() protected static method

Uploads a request to the Google API for reCAPTCHA data to be validated.
protected static UploadRecaptchaResponse ( NameValueCollection postParameters ) : string
postParameters System.Collections.Specialized.NameValueCollection The parameters to send in the POST message.
return string

Validate() public method

Determines if the reCAPTCHA response in a NameValueCollection passed validation.
If the returned Response is null, then a severe error occurred during the exchange.
public Validate ( NameValueCollection form, string remoteIp = null ) : Response
form System.Collections.Specialized.NameValueCollection The Request.Form to validate.
remoteIp string An optional IPAddress
return Response

Validator() public method

Creates a new instance of the Validator.
public Validator ( string reCaptchaSecret, string reCaptchaSiteKey ) : System
reCaptchaSecret string The reCAPTCHA secret.
reCaptchaSiteKey string The reCAPTCHA site key.
return System