Contact form 403 response, google reCaptcha

tommydev
Excursionist
15 0 4

Dear Community,

currently, I'm testing a new theme and one of the contact forms is not working(there are 2 contact form's in the theme, one is working and one not).

When I submit the contact form, an 403 error page appears and says the request for Google reCaptcha-validation failed(Request-Id: c3d6ccb3-0526-41df-812a-7fbf49611f96). If I turn off the reCaptcha validation in the Shopify Admin settings, the form works fine.

Since the liquid code for the form looks fine to me, I don't know how to proceed. Does anyone have some further steps I could take, to solve the problem? I have attached liquid code and a screenshot of the error screen.

Thanky you very much upfront!
Tom

{% form 'contact' %}
    <input
        type="text"
        id="ContactFormName"
        name="contact[name]"
        value="{% if form[name] %}{{ form[name] }}{% elsif customer %}{{ customer[name] }}{% endif %}">
    <input
        type="email"
        id="ContactFormEmail"
        name="contact[email]"
        autocorrect="off"
        autocapitalize="off"
        value="{% if form[email] %}{{ form[email] }}{% elsif customer %}{{ customer[email] }}{% endif %}" class="{% if form[errors] contains 'email' %}input--error{% endif %}">
    <input
        type="tel"
        id="ContactFormPhone"
        name="contact[phone]"
        pattern="[0-9\-]*"
        value="{% if form[phone] %}{{ form[phone] }}{% elsif customer %}{{ customer[phone] }}{% endif %}">
    <textarea
        id="ContactFormMessage"
        name="contact[body]"
        rows="10">
        {% if form.body %}
            {{ form.body }}
        {% endif %}
    </textarea>
{% endform %}

 Bildschirmfoto 2021-09-17 um 13.32.59.png

Replies 3 (3)

tommydev
Excursionist
15 0 4

I exported the failing http request from firefox as a js fetch, maybe that helps this data can also be helpful:

await fetch("https://x.myshopify.com/contact#contact_form", {
    "credentials": "include",
    "headers": {
        "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:92.0) Gecko/20100101 Firefox/92.0",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "Accept-Language": "de,en-US;q=0.7,en;q=0.3",
        "Content-Type": "application/x-www-form-urlencoded",
        "Alt-Used": "x.myshopify.com",
        "Upgrade-Insecure-Requests": "1",
        "Sec-Fetch-Dest": "document",
        "Sec-Fetch-Mode": "navigate",
        "Sec-Fetch-Site": "same-origin",
        "Sec-Fetch-User": "?1"
    },
    "referrer": "https://x.myshopify.com/products/3er-set-hairpin-legs?variant=33008878551085",
    "body": "form_type=contact&utf8=%E2%9C%93&contact%5Bname%5D=Tom&contact%5Bemail%5D=test%40example.com&contact%5Bphone%5D=&contact%5Bbody%5D=Subject+Line%3A+TEST%3Cbr%3EContent%3A+testtesttesttesttesttesttesttest%3Cbr%3E%3Cbr%3E%3Cb%3ESend+from+FAQs%3A+%3C%2Fb%3E%3Ca+href%3D%22https%3A%2F%2Fx.myshopify.com%2Fproducts%2F3er-set-hairpin-legs%22%3E3er+Set+HAIRPIN+Legs%3C%2Fa%3E",
    "method": "POST",
    "mode": "cors"
});

 please note, that I replaced my real email address with test@example.com and the shopify domain with "x".

attotasolutions
Shopify Partner
30 0 20
tommydev
Excursionist
15 0 4

Thank you very much for the link, attotasolutions!

So in my case Google thinks I'm a bot and blocks the contact form for more requests. I wonder if there is any way to exclude the IP address of our company, since we get the error all the time