reCaptcha With Lambda Part 2

By Adrian | November 14, 2019

In the previous article I covered all the steps and code that was required so that I can add a contact form with a reCaptcha on this very blog. These are the actual implementation steps I took to include them. Don’t worry the hard part has been done in part 1!

Create contact form

Using the client side HTML code I created the /content/contact.html file ensuring that I included the correct API Gateway URL’s for the post requests and the reCaptcha site key.

I had to delete the existing contact.md file.

Testing

Next, I ran the Hugo server locally and navigated to http://localhost:1313/contact

completed-form

I completed the form, and checked the I'm not a Robot button and this was the email I got:

email

I added in some special sauce in the server side index.js file where I’m capturing the X-Forwarded-For and User-Agent headers because theres some really useful information that can be gleaned from that.

So its all working as expected. The only thing that happens is that you are redirected back to the main sites page after completing the form instead of to a nice thank you page. One day I might learn HTML…… another day that is.