Ejemplo n.º 1
0
        private void ValidateCaptcha(CommentInput input, Commenter commenter)
        {
            if (Request.IsAuthenticated ||
                commenter.IsTrustedCommenter == true)
            {
                return;
            }

            if (RecaptchaValidatorWrapper.Validate(ControllerContext.HttpContext))
            {
                return;
            }

            ModelState.AddModelError("CaptchaNotValid",
                                     "You did not type the verification word correctly. Please try again.");
        }
Ejemplo n.º 2
0
        private void ValidateCaptcha(CommentInput input, Commenter commenter)
        {
            if (Request.IsAuthenticated ||
                (commenter != null && commenter.IsTrustedCommenter == true))
            {
                return;
            }

            var captchaChallegeSupplied = CheckRecaptchaChallengeSupplied();

            if (captchaChallegeSupplied == false)
            {
                ModelState.AddModelError("CaptchaNotValid", "ReCaptcha challenge was not supplied.");
                return;
            }

            if (RecaptchaValidatorWrapper.Validate(ControllerContext.HttpContext))
            {
                return;
            }

            ModelState.AddModelError("CaptchaNotValid",
                                     "You did not type the verification word correctly. Please try again.");
        }