diff --git a/GoogleRecaptcha.WebForms/Default.aspx b/GoogleRecaptcha.WebForms/Default.aspx index c7d6511..2109086 100644 --- a/GoogleRecaptcha.WebForms/Default.aspx +++ b/GoogleRecaptcha.WebForms/Default.aspx @@ -5,12 +5,12 @@ <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> - <title></title> + <title>Test the Google Recapcha V2 Server Control</title> </head> <body> <form id="frm" runat="server"> <div> - <asp:RecaptchaV2Control SiteKey="6LeF-QMTAAAAAPBTi98JAMFTF1lBzKrbyCri0JB_" SecretKey="6LeF-QMTAAAAAOw8M2RTtxoY6ifOhhUb4GlXpdB3" runat="server"/> + <asp:RecaptchaV2Control ID="gRecapcha" SiteKey="6LeF-QMTAAAAAPBTi98JAMFTF1lBzKrbyCri0JB_" SecretKey="6LeF-QMTAAAAAOw8M2RTtxoY6ifOhhUb4GlXpdB3" runat="server"/> </div> <asp:Button ID="btnVerify" runat="server" Text="Submit" OnClick="btnVerify_OnClick"/> </form> diff --git a/GoogleRecaptcha.WebForms/Default.aspx.designer.cs b/GoogleRecaptcha.WebForms/Default.aspx.designer.cs index db5e75c..5a65b37 100644 --- a/GoogleRecaptcha.WebForms/Default.aspx.designer.cs +++ b/GoogleRecaptcha.WebForms/Default.aspx.designer.cs @@ -21,6 +21,15 @@ public partial class Default { /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlForm frm; + /// <summary> + /// gRecapcha control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::GoogleRecaptchaWebForms.RecaptchaV2Control gRecapcha; + /// <summary> /// btnVerify control. /// </summary> diff --git a/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.WebForms.dll b/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.WebForms.dll index 017f549..dcfdfa4 100644 Binary files a/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.WebForms.dll and b/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.WebForms.dll differ diff --git a/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.WebForms.pdb b/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.WebForms.pdb index ae42a18..9ae3c98 100644 Binary files a/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.WebForms.pdb and b/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.WebForms.pdb differ diff --git a/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.dll b/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.dll index de86a9c..ae94c99 100644 Binary files a/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.dll and b/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.dll differ diff --git a/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.pdb b/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.pdb index 582e33e..ed053dd 100644 Binary files a/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.pdb and b/GoogleRecaptcha.WebForms/bin/GoogleRecaptcha.pdb differ diff --git a/GoogleRecaptcha.WebForms/bin/GoogleRecaptchaWebForms.dll b/GoogleRecaptcha.WebForms/bin/GoogleRecaptchaWebForms.dll index c8cec96..e313ef8 100644 Binary files a/GoogleRecaptcha.WebForms/bin/GoogleRecaptchaWebForms.dll and b/GoogleRecaptcha.WebForms/bin/GoogleRecaptchaWebForms.dll differ diff --git a/GoogleRecaptcha.WebForms/bin/GoogleRecaptchaWebForms.pdb b/GoogleRecaptcha.WebForms/bin/GoogleRecaptchaWebForms.pdb index 721f1fc..82b5e74 100644 Binary files a/GoogleRecaptcha.WebForms/bin/GoogleRecaptchaWebForms.pdb and b/GoogleRecaptcha.WebForms/bin/GoogleRecaptchaWebForms.pdb differ diff --git a/GoogleRecaptcha.WebForms/obj/Debug/GoogleRecaptcha.WebForms.csprojResolveAssemblyReference.cache b/GoogleRecaptcha.WebForms/obj/Debug/GoogleRecaptcha.WebForms.csprojResolveAssemblyReference.cache index 7f6451c..8848fad 100644 Binary files a/GoogleRecaptcha.WebForms/obj/Debug/GoogleRecaptcha.WebForms.csprojResolveAssemblyReference.cache and b/GoogleRecaptcha.WebForms/obj/Debug/GoogleRecaptcha.WebForms.csprojResolveAssemblyReference.cache differ diff --git a/GoogleRecaptcha.WebForms/obj/Debug/GoogleRecaptcha.WebForms.dll b/GoogleRecaptcha.WebForms/obj/Debug/GoogleRecaptcha.WebForms.dll index 017f549..dcfdfa4 100644 Binary files a/GoogleRecaptcha.WebForms/obj/Debug/GoogleRecaptcha.WebForms.dll and b/GoogleRecaptcha.WebForms/obj/Debug/GoogleRecaptcha.WebForms.dll differ diff --git a/GoogleRecaptcha.WebForms/obj/Debug/GoogleRecaptcha.WebForms.pdb b/GoogleRecaptcha.WebForms/obj/Debug/GoogleRecaptcha.WebForms.pdb index ae42a18..9ae3c98 100644 Binary files a/GoogleRecaptcha.WebForms/obj/Debug/GoogleRecaptcha.WebForms.pdb and b/GoogleRecaptcha.WebForms/obj/Debug/GoogleRecaptcha.WebForms.pdb differ diff --git a/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.WebMvc.dll b/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.WebMvc.dll index f4a7346..0d780dd 100644 Binary files a/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.WebMvc.dll and b/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.WebMvc.dll differ diff --git a/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.WebMvc.pdb b/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.WebMvc.pdb index 764c045..f531c85 100644 Binary files a/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.WebMvc.pdb and b/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.WebMvc.pdb differ diff --git a/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.dll b/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.dll index de86a9c..ae94c99 100644 Binary files a/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.dll and b/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.dll differ diff --git a/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.pdb b/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.pdb index 582e33e..ed053dd 100644 Binary files a/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.pdb and b/GoogleRecaptcha.WebMvc/bin/GoogleRecaptcha.pdb differ diff --git a/GoogleRecaptcha.WebMvc/bin/GoogleRecaptchaMvc.dll b/GoogleRecaptcha.WebMvc/bin/GoogleRecaptchaMvc.dll index fff0772..f3473d2 100644 Binary files a/GoogleRecaptcha.WebMvc/bin/GoogleRecaptchaMvc.dll and b/GoogleRecaptcha.WebMvc/bin/GoogleRecaptchaMvc.dll differ diff --git a/GoogleRecaptcha.WebMvc/bin/GoogleRecaptchaMvc.pdb b/GoogleRecaptcha.WebMvc/bin/GoogleRecaptchaMvc.pdb index c93032f..1ff969f 100644 Binary files a/GoogleRecaptcha.WebMvc/bin/GoogleRecaptchaMvc.pdb and b/GoogleRecaptcha.WebMvc/bin/GoogleRecaptchaMvc.pdb differ diff --git a/GoogleRecaptcha.WebMvc/obj/Debug/GoogleRecaptcha.WebMvc.csprojResolveAssemblyReference.cache b/GoogleRecaptcha.WebMvc/obj/Debug/GoogleRecaptcha.WebMvc.csprojResolveAssemblyReference.cache index ee359d0..8f4b17d 100644 Binary files a/GoogleRecaptcha.WebMvc/obj/Debug/GoogleRecaptcha.WebMvc.csprojResolveAssemblyReference.cache and b/GoogleRecaptcha.WebMvc/obj/Debug/GoogleRecaptcha.WebMvc.csprojResolveAssemblyReference.cache differ diff --git a/GoogleRecaptcha.WebMvc/obj/Debug/GoogleRecaptcha.WebMvc.dll b/GoogleRecaptcha.WebMvc/obj/Debug/GoogleRecaptcha.WebMvc.dll index f4a7346..0d780dd 100644 Binary files a/GoogleRecaptcha.WebMvc/obj/Debug/GoogleRecaptcha.WebMvc.dll and b/GoogleRecaptcha.WebMvc/obj/Debug/GoogleRecaptcha.WebMvc.dll differ diff --git a/GoogleRecaptcha.WebMvc/obj/Debug/GoogleRecaptcha.WebMvc.pdb b/GoogleRecaptcha.WebMvc/obj/Debug/GoogleRecaptcha.WebMvc.pdb index 764c045..f531c85 100644 Binary files a/GoogleRecaptcha.WebMvc/obj/Debug/GoogleRecaptcha.WebMvc.pdb and b/GoogleRecaptcha.WebMvc/obj/Debug/GoogleRecaptcha.WebMvc.pdb differ diff --git a/GoogleRecaptcha.v12.suo b/GoogleRecaptcha.v12.suo index 02bb00b..de46e75 100644 Binary files a/GoogleRecaptcha.v12.suo and b/GoogleRecaptcha.v12.suo differ diff --git a/GoogleRecaptcha/RecaptchaV2Data.cs b/GoogleRecaptcha/RecaptchaV2Data.cs index d7e80d8..d59a20a 100644 --- a/GoogleRecaptcha/RecaptchaV2Data.cs +++ b/GoogleRecaptcha/RecaptchaV2Data.cs @@ -13,7 +13,7 @@ public class RecaptchaV2Data public string Secret { get; set; } /// <summary> - /// Gets or sets the Response property. This property indicates that this is the response returned from the server. + /// Gets the Response property. This property indicates that this is the response returned from the server. /// </summary> public string Response { @@ -21,7 +21,7 @@ public string Response } /// <summary> - /// Gets or sets the RemoteIp property. This property indicates that this is remote ip address from the client. + /// Gets the RemoteIp property. This property indicates that this is remote ip address from the client. /// </summary> public string RemoteIp { diff --git a/GoogleRecaptcha/bin/Debug/GoogleRecaptcha.dll b/GoogleRecaptcha/bin/Debug/GoogleRecaptcha.dll index de86a9c..ae94c99 100644 Binary files a/GoogleRecaptcha/bin/Debug/GoogleRecaptcha.dll and b/GoogleRecaptcha/bin/Debug/GoogleRecaptcha.dll differ diff --git a/GoogleRecaptcha/bin/Debug/GoogleRecaptcha.pdb b/GoogleRecaptcha/bin/Debug/GoogleRecaptcha.pdb index 582e33e..ed053dd 100644 Binary files a/GoogleRecaptcha/bin/Debug/GoogleRecaptcha.pdb and b/GoogleRecaptcha/bin/Debug/GoogleRecaptcha.pdb differ diff --git a/GoogleRecaptcha/obj/Debug/GoogleRecaptcha.dll b/GoogleRecaptcha/obj/Debug/GoogleRecaptcha.dll index de86a9c..ae94c99 100644 Binary files a/GoogleRecaptcha/obj/Debug/GoogleRecaptcha.dll and b/GoogleRecaptcha/obj/Debug/GoogleRecaptcha.dll differ diff --git a/GoogleRecaptcha/obj/Debug/GoogleRecaptcha.pdb b/GoogleRecaptcha/obj/Debug/GoogleRecaptcha.pdb index 582e33e..ed053dd 100644 Binary files a/GoogleRecaptcha/obj/Debug/GoogleRecaptcha.pdb and b/GoogleRecaptcha/obj/Debug/GoogleRecaptcha.pdb differ diff --git a/GoogleRecaptchaMvc/bin/Debug/GoogleRecaptchaMvc.dll b/GoogleRecaptchaMvc/bin/Debug/GoogleRecaptchaMvc.dll index fff0772..f3473d2 100644 Binary files a/GoogleRecaptchaMvc/bin/Debug/GoogleRecaptchaMvc.dll and b/GoogleRecaptchaMvc/bin/Debug/GoogleRecaptchaMvc.dll differ diff --git a/GoogleRecaptchaMvc/bin/Debug/GoogleRecaptchaMvc.pdb b/GoogleRecaptchaMvc/bin/Debug/GoogleRecaptchaMvc.pdb index c93032f..1ff969f 100644 Binary files a/GoogleRecaptchaMvc/bin/Debug/GoogleRecaptchaMvc.pdb and b/GoogleRecaptchaMvc/bin/Debug/GoogleRecaptchaMvc.pdb differ diff --git a/GoogleRecaptchaMvc/obj/Debug/GoogleRecaptchaMvc.dll b/GoogleRecaptchaMvc/obj/Debug/GoogleRecaptchaMvc.dll index fff0772..f3473d2 100644 Binary files a/GoogleRecaptchaMvc/obj/Debug/GoogleRecaptchaMvc.dll and b/GoogleRecaptchaMvc/obj/Debug/GoogleRecaptchaMvc.dll differ diff --git a/GoogleRecaptchaMvc/obj/Debug/GoogleRecaptchaMvc.pdb b/GoogleRecaptchaMvc/obj/Debug/GoogleRecaptchaMvc.pdb index c93032f..1ff969f 100644 Binary files a/GoogleRecaptchaMvc/obj/Debug/GoogleRecaptchaMvc.pdb and b/GoogleRecaptchaMvc/obj/Debug/GoogleRecaptchaMvc.pdb differ diff --git a/GoogleRecaptchaWebForms/RecaptchaV2Control.cs b/GoogleRecaptchaWebForms/RecaptchaV2Control.cs index 64be9a2..a50705b 100644 --- a/GoogleRecaptchaWebForms/RecaptchaV2Control.cs +++ b/GoogleRecaptchaWebForms/RecaptchaV2Control.cs @@ -88,9 +88,33 @@ public void Validate() new RecaptchaV2Data() { Secret = SecretKey }); var result = recaptcha.Verify(); IsValid = result.Success; - if(!IsValid && result.ErrorCodes.Length > 0) + if (IsValid) return; + if(result.ErrorCodes.Length > 0) { - ErrorMessage = result.ErrorCodes[0]; + ErrorMessage = String.Empty; + foreach (var errorCode in result.ErrorCodes) + { + switch (errorCode) + { + case "missing-input-secret": + ErrorMessage += "The secret parameter is missing - "; + break; + case "invalid-input-secret": + ErrorMessage += "The secret parameter is invalid or malformed - "; + break; + case "missing-input-response": + ErrorMessage += "The response parameter is missing - "; + break; + case "invalid-input-response": + ErrorMessage += "The response parameter is invalid or malformed - "; + break; + } + ErrorMessage = ErrorMessage.TrimEnd(' ', '-'); + } + } + else + { + ErrorMessage = "Oops! Unknown error!"; } } } diff --git a/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptcha.dll b/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptcha.dll index de86a9c..ae94c99 100644 Binary files a/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptcha.dll and b/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptcha.dll differ diff --git a/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptcha.pdb b/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptcha.pdb index 582e33e..ed053dd 100644 Binary files a/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptcha.pdb and b/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptcha.pdb differ diff --git a/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptchaWebForms.dll b/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptchaWebForms.dll index c8cec96..e313ef8 100644 Binary files a/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptchaWebForms.dll and b/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptchaWebForms.dll differ diff --git a/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptchaWebForms.pdb b/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptchaWebForms.pdb index 721f1fc..82b5e74 100644 Binary files a/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptchaWebForms.pdb and b/GoogleRecaptchaWebForms/bin/Debug/GoogleRecaptchaWebForms.pdb differ diff --git a/GoogleRecaptchaWebForms/obj/Debug/GoogleRecaptchaWebForms.csprojResolveAssemblyReference.cache b/GoogleRecaptchaWebForms/obj/Debug/GoogleRecaptchaWebForms.csprojResolveAssemblyReference.cache index 67cde0c..b5440b5 100644 Binary files a/GoogleRecaptchaWebForms/obj/Debug/GoogleRecaptchaWebForms.csprojResolveAssemblyReference.cache and b/GoogleRecaptchaWebForms/obj/Debug/GoogleRecaptchaWebForms.csprojResolveAssemblyReference.cache differ diff --git a/GoogleRecaptchaWebForms/obj/Debug/GoogleRecaptchaWebForms.dll b/GoogleRecaptchaWebForms/obj/Debug/GoogleRecaptchaWebForms.dll index c8cec96..e313ef8 100644 Binary files a/GoogleRecaptchaWebForms/obj/Debug/GoogleRecaptchaWebForms.dll and b/GoogleRecaptchaWebForms/obj/Debug/GoogleRecaptchaWebForms.dll differ diff --git a/GoogleRecaptchaWebForms/obj/Debug/GoogleRecaptchaWebForms.pdb b/GoogleRecaptchaWebForms/obj/Debug/GoogleRecaptchaWebForms.pdb index 721f1fc..82b5e74 100644 Binary files a/GoogleRecaptchaWebForms/obj/Debug/GoogleRecaptchaWebForms.pdb and b/GoogleRecaptchaWebForms/obj/Debug/GoogleRecaptchaWebForms.pdb differ