Parts of this code are based on the implementation described in this article:
Adding reCaptcha v3 to a Rails app without a gem
By default recaptcha will use the first grecaptch widget that it comes across, which makes having multiple forms on the page malfunction.