コード例 #1
0
ファイル: Recaptcha.cs プロジェクト: TechnicsUser/newForum
        /// <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;
            }
        }
コード例 #2
0
ファイル: Recaptcha.cs プロジェクト: jiangsq123/YAFNET
        /// <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;
                }
            }
        }
コード例 #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;
        }
      }
    }