[HttpPost] | |
public async Task<ActionResult> Form() | |
{ | |
RecaptchaVerificationHelper recaptchaHelper = this.GetRecaptchaVerificationHelper(); | |
if (String.IsNullOrEmpty(recaptchaHelper.Response)) | |
{ | |
ModelState.AddModelError("", "Le captcha ne peut être vide."); | |
return PartialView(); | |
} | |
RecaptchaVerificationResult recaptchaResult = await recaptchaHelper.VerifyRecaptchaResponseTaskAsync(); | |
if (recaptchaResult != RecaptchaVerificationResult.Success) | |
{ | |
ModelState.AddModelError("", "Réponse captcha invalide."); | |
return PartialView(); | |
} | |
if (ModelState.IsValid) | |
{ | |
return PartialView("_FormResult"); | |
} | |
return PartialView(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment