close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Google reCaptcha v3 timeout problem

Thread began 1/31/2021 6:26 am by MagsW | Last modified 2/02/2021 10:25 am by Ray Borduin | 289 views | 12 replies |

MagsW

Google reCaptcha v3 timeout problem

Hi Ray, I know this is above and beyond the call of duty, but you're the only person I can think to ask for help!

I've integrated reCaptcha v3 into a client's multiple websites which have contact forms using Universal Email on a number of pages, so the contact form and email script are in shared PHP files and embedded on the pages. Everything seemed to be working OK, however the client has reported a number of people saying they've submitted the contact form and didn't get a response. I check the database log and sure enough, these emails hadn't been received, but others had.

After doing some digging and by a process of elimination, I've discovered that the problem is caused by the reCaptcha's default timeout setting of (I think) a couple of minutes. So, if someone takes longer than this to type in the message, the email doesn't send. However, to them it looks as if it has because the page redirects to ?sent=true and the success message appears.

I've spent hours this morning trying various 'solutions' I've found both on the Google Developers site and on Stack Overflow, but can't get any of them to correctly override the timeout. Is this something you could help me with? I can give you links to the solutions I've found and I think I just need to find the correct way of integrating it into my code without breaking anything. Happy to pay for a dedicated support session as I need to get it sorted out urgently!

Sign in to reply to this post

Ray BorduinWebAssist

I don't think that is the issue. When implemented correctly, you shouldn't get to the success page when reCaptcha fails.

If you attach the page you are working on I can take a look.

Sign in to reply to this post
Did this help? Tips are appreciated...

MagsW

Thanks for much for this. I've attached an example of a page which works, however as I said if you take longer than 2 minutes or so to fill in the form it doesn't send the email to the client and doesn't log in the database. It does display the success message and send the confirmation email.

There's a thread here about the problem with the reCaptcha token expiring: https://stackoverflow.com/questions/51507695/google-recaptcha-v3-example-demo/60036326#60036326 - if you scroll down to the post that says:

"I am generating a google Recaptcha token at the client side at every 3 seconds of time interval because the token is valid for only a few minutes that's why if any user takes time to fill the form then it may be expired", it gives a working code example. I copied that as-is and it does work, but I I can't figure out how to integrate my existing code with it. Seems to me it should just be a case of adding something to the Javascript to force it to renew the token every 3 seconds but my Javascript knowledge isn't good enough!

Sign in to reply to this post

Ray BorduinWebAssist

You have two emails on the page, but only one checks to see if it passed reCaptcha. You should wrap both in the reCaptcha check so that no email gets sent when the captcha fails. Then you can give the error when it fails to prevent people from thinking it went through.

Now you could also try to fix the issue with the captcha expiring after 3 minutes, but I think you should fix the issue that the captcha test doesn't actually prevent the second email or redirect as well.

Sign in to reply to this post
Did this help? Tips are appreciated...

MagsW

I've updated the page as you suggested - now if you wait more than 2 minutes before sending, it will display "spam test failed" at the top of the page. In addition to overriding the timeout issue, I would need to display the error message above the form instead. Updated page attached.

Sign in to reply to this post

Ray BorduinWebAssist

These are hand coding issues that I'd have to do in a premier support ticket if you want me to do them for you.

I'd implement the reCaptcha v3 with webassist Server Behaviors to allow configuration of the error message more easily.

The reset of the captcha I've seen done online, it looks like you just have to add a javascript timer to reset it after 3 minutes.

These are things I can help with in a premier support ticket. If you want to try to do it on your own, then you can ask questions here and I'll try to help.

Sign in to reply to this post
Did this help? Tips are appreciated...

MagsW

Happy to let you do it via a Premier Support ticket - I spent hours on Sunday trying to figure it out myself so I think it's worth doing! Let me know how we do it and when suits.

Sign in to reply to this post

Ray BorduinWebAssist

Please reply with a US phone number or Skype contact information in the private area and I'll give you a call to set it up.

Sign in to reply to this post
Did this help? Tips are appreciated...

MagsW

See PM.

Sign in to reply to this post

Ray BorduinWebAssist

My Skype name is webassist.rborduin. Please text me there and we can set something up.

Sign in to reply to this post
Did this help? Tips are appreciated...
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...