Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-validate google reCAPTCHA if user response token expired #34469

Closed
AartiJogiya opened this issue Oct 28, 2021 · 20 comments
Closed

Re-validate google reCAPTCHA if user response token expired #34469

AartiJogiya opened this issue Oct 28, 2021 · 20 comments
Assignees
Labels
Issue: needs update Additional information is require, waiting for response Progress: needs update Reported on 2.4.3-p1 Indicates original Magento version for the Issue report.

Comments

@AartiJogiya
Copy link

Google reCAPTCHA has token restrictions that is user response token expires after two minutes and to create new token we need to re-run reCAPTCHA varification. Refer Google reCAPTCHA document. On the customer create account page, it should re-run the reCAPTCHA varification in case previous user response token is expired and should not generate an error "Can not resolve reCAPTCHA parameter"

Preconditions (*)

  1. magento 2.4.3, 2.4.3-p1
  2. Configure google reCAPTCHA v2-invisible
  3. Enable google reCAPTCHA on create new customer account form (Stores > Configuration > Security > Google reCAPTCHA Storefront.

Steps to reproduce (*)

  1. Go to Create account page in storefront.
  2. Fill the form using any existing users email.
  3. Submit the form and it will show error message saying "There is already an account with this email address."
  4. wait for at least two minutes without refreshing the page and then submit the form with keeping one required field empty.
  5. Submit the form again

Expected result (*)

It should validate reCAPTCHA and if the user response token is expired it should execute reCAPTCHA verification again.

Actual result (*)

It posts empty "g-recaptcha-response" value on form submit after reCAPTCHA user response token is expired and therefore logs exception "Can not resolve reCAPTCHA parameter." and also shows error notification saying "Something went wrong with reCAPTCHA. Please contact the store owner".

Error log in exception.log:
main.ERROR: Can not resolve reCAPTCHA parameter. {"exception":"[object] (Magento\Framework\Exception\InputException(code: 0): Can not resolve reCAPTCHA parameter. at /var/www/public_html/vendor/magento/module-re-captcha-ui/Model/CaptchaResponseResolver.php:25)"} []
create_new_account

@m2-assistant
Copy link

m2-assistant bot commented Oct 28, 2021

Hi @AartiJogiya. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-community-project m2-community-project bot added this to Ready for Confirmation in Issue Confirmation and Triage Board Oct 28, 2021
@AartiJogiya AartiJogiya changed the title re-validate google reCAPTCHA after user response token expired on customer create account page. Re-validate google reCAPTCHA if user response token expired on customer create account page. Oct 28, 2021
@AartiJogiya AartiJogiya changed the title Re-validate google reCAPTCHA if user response token expired on customer create account page. Re-validate google reCAPTCHA if user response token expired Oct 28, 2021
@ajijshekh123 ajijshekh123 self-assigned this Oct 28, 2021
@m2-assistant
Copy link

m2-assistant bot commented Oct 28, 2021

Hi @ajijshekh123. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@ajijshekh123
Copy link

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @ajijshekh123. Thank you for your request. I'm working on Magento instance for you.

@ajijshekh123 ajijshekh123 removed their assignment Oct 28, 2021
@engcom-Hotel engcom-Hotel self-assigned this Oct 29, 2021
@m2-assistant
Copy link

m2-assistant bot commented Oct 29, 2021

Hi @engcom-Hotel. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Hotel
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @engcom-Hotel. Thank you for your request. I'm working on Magento instance for you.

@engcom-Hotel
Copy link
Contributor

engcom-Hotel commented Oct 29, 2021

Hello @AartiJogiya,

We have tried to reproduce the issue in Magento 2.4-develop branch, but for us, it is not reproducible, please have a look at the below screenshot for reference, on both the times we are getting this error message:
image

As mentioned in the issue description, keeping the required field empty and then pressing the "Create an Account" button, is not allow us to submit the page. In that case, we are getting the below error (Please refer to "This field is required" error message for "Confirm Password" field):
image

Please tell us if we missed anything in order to reproduce the issue.

Thanks

@engcom-Hotel engcom-Hotel added Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Progress: needs update Reported on 2.4.3-p1 Indicates original Magento version for the Issue report. labels Oct 29, 2021
@hoangoclan
Copy link

Hi @engcom-Hotel, cc @AartiJogiya ,

I am also facing many error log in exception.log:
main.ERROR: Unable to resolve parameter reCAPTCHA. {"exception": "[object] (Magento\Framework\Exception\InputException (code: 0): Unable to resolve parameter reCAPTCHA. at /var/www/public_html/provider/magento/module-re-captcha-ui) /Model /CaptchaResponseResolver.php:25) "} []

I am using: Magento 2.4.2, reCAPTCHA v3 Invisible on the storefront. But I can't reproduce it either.
Thanks.

@engcom-Hotel
Copy link
Contributor

engcom-Hotel commented Nov 2, 2021

Hello @hoangoclan,

Please provide us with the steps to reproduce the issue.

Thanks

@engcom-Hotel engcom-Hotel added Issue: needs update Additional information is require, waiting for response and removed Issue: ready for confirmation labels Nov 2, 2021
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Nov 2, 2021
@m2-community-project m2-community-project bot removed the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Nov 2, 2021
@hoangoclan
Copy link

hoangoclan commented Nov 3, 2021

Hi @engcom-Hotel ,
I see it appear in exception.log on the production site, but I have not been able to reproduce it. I'm just trying to give everyone more information that this issue seems to appear in Magento 2.4.2, reCAPTCHA v3 Invisible on the storefront.

@Quentin-Sch
Copy link

Same on my site.
On 2 natives Magento 2.4.2 websites with same config
Random..

@hoangoclan
Copy link

Hi @Quentin-Sch , cc @AartiJogiya , @engcom-Hotel

I have investigated the cause of it.
In very slow internet conditions, the customer can submit the form before the recaptcha is downloaded and rendered. This results in the Recaptcha not being validated in the FO.

In my project, I have disabled the submit button by default and enabled it when the Recaptcha is ready.

Hope it is useful to you.

@engcom-Hotel
Copy link
Contributor

Hello @AartiJogiya

We have rechecked the issue, but still, we are unable to reproduce it.

@hoangoclan as per your comment, we have tried to reproduce the issue in the slow network by using Throttling dropdown in chrome browser and selecting Slow 3G option but still, we are unable to reproduce the issue. Please suggest the missing steps.

Thanks

@nmintcheva
Copy link

nmintcheva commented Dec 15, 2021

Hello, I was able to reproduce it with the same exception.log error message as above (only difference is my local is on 2.4.3-p1). The steps I took on my local were to 1. enable reCaptcha v2 invisible and 2. try to submit a message through the contact form.

@engcom-Hotel
Copy link
Contributor

Hello @nmintcheva,

We have tried to reproduce these steps as well but still, the issue is not reproducible for us.

Please tell us if we missed anything in order to reproduce the issue.

Thanks

@engcom-Hotel
Copy link
Contributor

Dear @AartiJogiya,

We have noticed that this issue has not been updated for a period of 14 Days. Hence we assume that this issue is fixed now, so we are closing it. Please raise a fresh ticket or reopen this ticket if you need more assistance on this.

Regards

@TheLaughingThird
Copy link

TheLaughingThird commented Jan 11, 2022

I ran into this issue , after upgrading to 2.4.1-p1 from 2.3.7

Trying to login , then get a red error message:

"Something went wrong with reCAPTCHA. Please contact the store owner." ,

TO ALLOW yourself access to your backend follow these steps:

  1. Run this ONE command from CLI

php bin/magento module:disable Magento_ReCaptchaAdminUi Magento_ReCaptchaCheckout Magento_ReCaptchaContact Magento_ReCaptchaCustomer Magento_ReCaptchaFrontendUi Magento_ReCaptchaMigration Magento_ReCaptchaNewsletter Magento_ReCaptchaPaypal Magento_ReCaptchaReview Magento_ReCaptchaSendFriend Magento_ReCaptchaUi Magento_ReCaptchaUser Magento_ReCaptchaValidation Magento_ReCaptchaValidationApi Magento_ReCaptchaVersion2Checkbox Magento_ReCaptchaVersion2Invisible Magento_ReCaptchaVersion3Invisible

  1. THEN log into the backend , STAY logged in

  2. run ONLY this ONE command to re enable captcha:

php bin/magento module:enable Magento_ReCaptchaAdminUi Magento_ReCaptchaCheckout Magento_ReCaptchaContact Magento_ReCaptchaCustomer Magento_ReCaptchaFrontendUi Magento_ReCaptchaMigration Magento_ReCaptchaNewsletter Magento_ReCaptchaPaypal Magento_ReCaptchaReview Magento_ReCaptchaSendFriend Magento_ReCaptchaUi Magento_ReCaptchaUser Magento_ReCaptchaValidation Magento_ReCaptchaValidationApi Magento_ReCaptchaVersion2Checkbox Magento_ReCaptchaVersion2Invisible Magento_ReCaptchaVersion3Invisible

  1. Navigate in the magento admin panel to STORE->CONFIGURATION->SECURITY and view all recaptcha entries, in my case the API key was not right. So I cleared the API entries, and I made sure that captcha set to no everywhere. Then flushed cache and logged successfully into Magento to reconfigure captcha.

For more info feel free to contact me on github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: needs update Additional information is require, waiting for response Progress: needs update Reported on 2.4.3-p1 Indicates original Magento version for the Issue report.
Projects
None yet
Development

No branches or pull requests

7 participants