Recaptcha plugin for rails

I am currently using the ambethia recaptcha plugin for rails. I want to disable the message

"wrong-captcha sol"

whenever a user incorrectly enters an incorrect recaptcha. How can I do it?

In the source file, I get the following tags surrounding the error message

<p class="recaptcha_error">incorrect-captcha-sol</p> 
+4
source share
4 answers

The plugin sets flash (more precisely, flash [: recaptcha_error]), that is, it will not display the message automatically. Most likely, you have a piece of code that displays all flash messages. Try removing it and / or excluding the flash [: recaptcha_error] from displaying.

+3
source

Since flash [] is an array, you can delete it inside. When we use the recaptcha gem, the flash array contains the recaptcha_error element, so you just delete this element only with: flash.delete (: recaptcha_error) inside your controller.

For instance:

 if verify_recaptcha(:model=>@object,:message=>"Verification code is wrong", :attribute=>"verification code") && @object.save #your code if succes else flash.delete(:recaptcha_error) #your code if its fail end 

Perhaps this may help you. Thanks

+11
source

I solved this, these are the most unusual things that I came across, my syntax was earlier:

 <table> <form> <tr><td></td></tr> </form> </table> 

I changed it to this:

 <form> <table> <tr><td></td></tr> </table> </form> 

Because of this switch, suddenly reaptcha_response_field and recaptcha_challenge_field send values ​​back to the form.

I cannot understand why this is because all MY form variables were sent back before the switch.

0
source

You can get this because you did not post the translation file. I think the correct way is not to delete the flash message, but to put the i18n file

Example:

 en: recaptcha: errors: incorrect-captcha-sol: 'Fail' 

See https://github.com/ambethia/recaptcha#i18n-support

0
source

All Articles