Esempio n. 1
0
        /// <summary>
        /// The validate.
        /// </summary>
        public void Validate()
        {
            if (this.skipRecaptcha)
            {
                this.recaptchaResponse = RecaptchaResponse.Valid;
            }

            if (this.recaptchaResponse != null)
            {
                return;
            }

            var validator = new RecaptchaValidator
            {
                SecretKey = this.SecretKey,
                RemoteIP  = this.Page.Request.GetUserRealIPAddress(),
                Response  = this.Context.Request.Form["g-recaptcha-response"]
            };

            try
            {
                this.recaptchaResponse = validator.Validate();
            }
            catch (ArgumentNullException exception)
            {
                this.recaptchaResponse = null;
                this.errorMessage      = exception.Message;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// The validate.
        /// </summary>
        public void Validate()
        {
            if (this.skipRecaptcha)
            {
                this.recaptchaResponse = RecaptchaResponse.Valid;
            }

            if (((this.recaptchaResponse == null) && this.Visible) && this.Enabled)
            {
                var validator = new RecaptchaValidator();
                validator.PrivateKey = this.PrivateKey;
                validator.RemoteIP   = this.Page.Request.GetUserRealIPAddress();
                validator.Challenge  = this.Context.Request.Form["recaptcha_challenge_field"];
                validator.Response   = this.Context.Request.Form["recaptcha_response_field"];
                try
                {
                    this.recaptchaResponse = validator.Validate();
                }
                catch (ArgumentNullException exception)
                {
                    this.recaptchaResponse = null;
                    this.errorMessage      = exception.Message;
                }
            }
        }
Esempio n. 3
0
    /// <summary>
    /// The validate.
    /// </summary>
    public void Validate()
    {
      if (this.skipRecaptcha)
      {
        this.recaptchaResponse = RecaptchaResponse.Valid;
      }

      if (((this.recaptchaResponse == null) && this.Visible) && this.Enabled)
      {
        var validator = new RecaptchaValidator();
        validator.PrivateKey = this.PrivateKey;
        validator.RemoteIP = this.Page.Request.UserHostAddress;
        validator.Challenge = this.Context.Request.Form["recaptcha_challenge_field"];
        validator.Response = this.Context.Request.Form["recaptcha_response_field"];
        try
        {
          this.recaptchaResponse = validator.Validate();
        }
        catch (ArgumentNullException exception)
        {
          this.recaptchaResponse = null;
          this.errorMessage = exception.Message;
        }
      }
    }