Skip to content

Commit

Permalink
Merge pull request #7 from JoshScan/master
Browse files Browse the repository at this point in the history
Fixed false antiforgery exception
  • Loading branch information
TimothyMeadows committed Jan 4, 2019
2 parents ee4df30 + 20218db commit 6b76762
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion reCAPTCHA.AspNetCore/RecaptchaService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task<RecaptchaResponse> Validate(HttpRequest request, bool antiForg
var captchaResponse = JsonConvert.DeserializeObject<RecaptchaResponse>(result);

if (captchaResponse.success && antiForgery)
if (captchaResponse.hostname?.ToLower() != request.Host.Value?.ToLower())
if (captchaResponse.hostname?.ToLower() != request.Host.Host?.ToLower())
throw new ValidationException("Recaptcha host, and request host do not match. Forgery attempt?");

return captchaResponse;
Expand Down

0 comments on commit 6b76762

Please sign in to comment.