Problem with contact page

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #10037248
    ppericles
    Participant

    Hello,
    I moved my site’s html files to language specific folders.
    Since then, my contact page no longer works at all.

    I get an error that “This page isn’t working right now”.

    Could you please help?

    Thanks.



    Template Version: 8.3
    #10037250
    ppericles
    Participant

    Hello again,
    Tried a few things and now I get the following error:
    {“response”:”error”,”errorMessage”:”reCaptcha Error: Invalid token. Please contact the website administrator.”}
    although the google captcha site and secret keys are correct.


    #10037259
    Support
    Keymaster
    This reply has been marked as private.
    #10037265
    ppericles
    Participant

    Hello,
    The problem arises when I add the language code at the end of the site key.
    I tried both &hl= and &lang=, which I have tried in the past and worked, but now they don’t.
    Any ideas would be greatly appreciated.

    Thanks.


    #10037275
    Support
    Keymaster

    Hello,

    That’s probably you are using the V3 of recaptcha, where an action from user is not needed. The V3 detect that the user is not a bot trough javascript events. The language is useful when using the V2 of recaptcha.

    Hope this helps and clarify!

    Kind Regards,

    Rodrigo.


    If you are satisfied with Porto HTML and our support, please leave your comment and rating on ThemeForest downloads page. That helps us a lot: https://themeforest.net/downloads


    #10037280
    ppericles
    Participant
    This reply has been marked as private.
    #10037287
    Support
    Keymaster

    Hello,

    Oh, you are right!

    Inspecting more deeply I saw that’s a problem with our JS code.

    Please change site_key variable at (view.contact.js) to:

    var site_key = $('#google-recaptcha-v3').attr('src').split("render=")[1].replace('&hl=en','');

    We hope this helps!

    kind Regards,

    Rodrigo.


    If you are satisfied with Porto HTML and our support, please leave your comment and rating on ThemeForest downloads page. That helps us a lot: https://themeforest.net/downloads


    #10037298
    ppericles
    Participant

    Hello,
    I do not really understand what is the effect of the proposed change. Anyway, it does not produce the desired result (display of recaptcha logo in a languege other than English, which is the default).
    You are striping from the site key the portion with &hl=en.
    But, in order to display the recaptcha v3 logo in a different language other than English, the hl can take many values (in my case is el for Greek).
    I assume that you are proposing this change while keeping the existing version of the contact form (found in https://www.abybill.eu/contact-us.html).

    Thanks.


    #10037304
    Support
    Keymaster

    Hello,

    You are definitely right! Sorry I did not think you was using the same JS script for both versions.

    We can easily get the country code from the url. Please try changing that part of code to:

    var countryCode = window.location.pathname.split('/')[1],
        site_key = $('#google-recaptcha-v3').attr('src').split("render=")[1].replace('&hl='+countryCode,'');

    Hope this helps!

    Kind Regards,

    Rodrigo.


    If you are satisfied with Porto HTML and our support, please leave your comment and rating on ThemeForest downloads page. That helps us a lot: https://themeforest.net/downloads


    #10037308
    ppericles
    Participant

    Hello,
    Thank you for your answer.
    If you strip from the site key everything from & onwards until the end of the string, then your solution would be made more generic and independent of the site’s url including the language indicator.
    Could you please show me how to do that?

    Thanks.


    #10037321
    Support
    Keymaster

    Hello,

    That’s a good idea too! And we will implement this logic in the template files for next version. Thanks.

    Here’s the code you need:

    var recaptchaSrcURL = $('#google-recaptcha-v3').attr('src'),
        newURL          = new URL(recaptchaSrcURL),
        site_key        = newURL.searchParams.get("render");

    Hope this helps!

    kind Regards,

    Rodrigo.


    If you are satisfied with Porto HTML and our support, please leave your comment and rating on ThemeForest downloads page. That helps us a lot: https://themeforest.net/downloads


    #10037329
    ppericles
    Participant

    Hello,
    Thank you very much. It works perfectly.
    Will you include the change in view.contact.js in future updates of the Porto template?

    Thanks again.


    #10037334
    Support
    Keymaster

    Hello,

    Great!

    Yes, the next version of the template will have this code at view.contact.js

    Thanks for your suggestion!

    Kind Regards,

    Rodrigo.


    If you are satisfied with Porto HTML and our support, please leave your comment and rating on ThemeForest downloads page. That helps us a lot: https://themeforest.net/downloads


Viewing 13 posts - 1 through 13 (of 13 total)

This topic is marked as "RESOLVED" and can not rceive new replies.