honeyprakash / recaptcha

Automatically exported from code.google.com/p/recaptcha
0 stars 0 forks source link

ASP.NET Validation summary error message does not allow to localize #105

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create ASP.NET validation summary control.
2. When invalid. RecaptchaResponse readonly error message shown.
3.

What is the expected output? What do you see instead?
The reCaptcha does not allow to localize its error messages.

What version of the product are you using? On what operating system?
reCAPTCHA .NET Library v1.0.5.0 Binary Only 

Please provide any additional information below.
Language variant is important nowadays especially used for global application, 
and as well, allow the flexibility of error message update would be great. I 
knew we can use literal/label control to make the language variant but allowing 
ErrorMessage on control to set message is what I think should make available. 

Original issue reported on code.google.com by hock.hen...@gmail.com on 20 Mar 2011 at 1:34

GoogleCodeExporter commented 8 years ago
You can override this message via custom translation.
http://code.google.com/apis/recaptcha/docs/customization.html#i18n

Original comment by adrian.g...@gmail.com on 28 Apr 2011 at 11:55

GoogleCodeExporter commented 8 years ago
I tried overriding the message via custom translation using the link provided 
as suggested.  However, this approach didn't work for me.  I'm using the latest 
codebase. My code is below:
<script type="text/javascript">
        var RecaptchaOptions = {
                custom_translations : {
                        incorrect_try_again : "My custom error"
                }
        };
        enableDebug();
        writeDebug("After RecaptchOptions set");
        writeDebugObject(RecaptchaOptions);

</script>                                                               
<recaptcha:RecaptchaControl
       ID="recaptcha"
       runat="server"
       Theme="clean"
       PublicKey="xyz"            
       PrivateKey="xyz
       />
       <script type="text/javascript">
               writeDebug("After RecaptchaControl Call");
               writeDebugObject(RecaptchaOptions);
               </script>

I replaced the private/public keys for security reasons.  

I'm a novice at JavaScript at best, however, here's some things I discovered:
the variable RecaptchaOptions in the rendered HTML page was being set to twice. 
 Once using my code above and another time by the reCaptcha ASP control.  This 
was causing my custom_translations to get wiped out.  I went ahead and 
commented out the code that rendered the RecaptchaOptions settings from the 
control.  This allowed me to see my custom error message set in the 
incorrect_try_again portion of the RecaptchaStr variable, however, the 
verification always returned the following on errors:
HTTP/1.0 200 OK
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Thu, 26 May 2011 21:46:13 GMT
Content-Type: text/plain
X-Recaptcha-Request-Duration: 245
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Server: GSE

false
incorrect-captcha-sol

I could never get a custom error message from the reCAPTCHA API.  

I've been battling this for a couple of days now, any help would be appreciated.

Thanks,
Rafi

Original comment by rghaz...@gmail.com on 26 May 2011 at 11:40

GoogleCodeExporter commented 8 years ago
I have encountered the same problem when trying to localize the error message.

Running the test project I've found that even in the CustomTranslation.aspx 
page you cannot display a custom error message. Sure everything else is 
localized but after POST, the same predefined message: "The verification words 
are incorrect." is displayed.

If I'm missing something please let me know because my solution was to modify 
the ErrorMessage property inside RecaptchaControl.cs to allow set. This is not 
a good solution but I've already wasted hours on this issue.

Valentin

Original comment by valentin...@gmail.com on 19 Oct 2011 at 1:51

GoogleCodeExporter commented 8 years ago
Fixed in r196. Get latest source and rebuild.

Root cause: I was under the impression that reCAPTCHA will provide the custom 
error message, but apparently this was not the case.

Original comment by adrian.g...@gmail.com on 19 Oct 2011 at 5:28

GoogleCodeExporter commented 8 years ago

Original comment by adrian.g...@gmail.com on 30 Mar 2012 at 6:18

GoogleCodeExporter commented 8 years ago
Hi adrian,

I used reCaptcha for .Net, I'm having the same problem, I can't localize error 
Message.

I downloaded reCAPTCHA's lastest version, then i did checkout from r196 and 
rebuild the project but i'm having the same issue.

Can anybody help me? my e-mail is ivan.franco@improvein.com 

Original comment by ivan.fra...@improvein.com on 23 Jul 2013 at 9:11

GoogleCodeExporter commented 8 years ago
I wrote about how you can localize the error messages here: 
http://stackoverflow.com/a/7825663/6289

Basically you need to set the localized messages through CustomTranslations 
property. The natural way would be to allow set on ErrorMessage property and I 
think a lot a confusion comes from that decision.

Original comment by valentin...@gmail.com on 24 Jul 2013 at 5:44