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

[Issue] Moving array access for CAPTCHA _.isEmpty check #31641

Closed
4 tasks
m2-assistant bot opened this issue Jan 13, 2021 · 2 comments · Fixed by #31636
Closed
4 tasks

[Issue] Moving array access for CAPTCHA _.isEmpty check #31641

m2-assistant bot opened this issue Jan 13, 2021 · 2 comments · Fixed by #31636
Assignees
Labels
Component: Captcha Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.

Comments

@m2-assistant
Copy link

m2-assistant bot commented Jan 13, 2021

This issue is automatically created based on existing pull request: #31636: Moving array access for CAPTCHA _.isEmpty check


When upgrading to 2.3.6 from 2.3.5-p2, a new CAPTCHA zone "payment_processing_request" is added.

If a customer has an existing session (from 2.3.5-p2 or prior), and tries to access checkout with their existing session data, checkout will fail to load because the check to see if captchaData[formId] exists is not a valid function call.
_.isEmpty() only returns a boolean value, so it cannot be enumerated like an array. Array access syntax has been moved in to the check, rather than outside it.

Description (*)

This change allows a _.isEmpty() check in the defaultCaptcha.js file to complete successfully, resolving issues with the checkout failing to load or infinitely loading after upgrading.

Related Pull Requests

N/A

Fixed Issues (if relevant)

N/A - no reported issue for this yet?

Manual testing scenarios (*)

  1. Create an instance prior to 2.3.6 (eg: 2.3.5-p2)
  2. Load the /checkout route in a valid way (eg: add to basket, create an account, click "go to checkout")
  3. Observe the captcha key of the mage-cache-storage local storage key. There should not be an entry for payment_processing_request
  4. Upgrade to 2.3.6 or another version that does include the fix introduced via MC-36200
  5. Load the /checkout route with the same session as before
  6. Observe an infinite load on the checkout page and errors in the console along the lines of:
defaultCaptcha.js:60 Uncaught TypeError: Cannot read property 'timestamp' of undefined
    at UiClass.checkCustomerData (defaultCaptcha.js:60)
    at UiClass.<anonymous> (defaultCaptcha.js:43)
    at Function.each (jquery.js:382)
    at UiClass.initialize (defaultCaptcha.js:38)
    at UiClass.initialize (wrapper.js:109)
    at UiClass._super (wrapper.js:106)
    at UiClass.initialize (loginCaptcha.js:21)
    at UiClass.initialize (wrapper.js:109)
    at new UiClass (class.js:49)
    at Object.initComponent (layout.js:137)
  1. Apply patch
  2. Attempt to load /checkout again
  3. Observe checkout loads as expected

Questions or comments

I'm not sure if an issue is needed for this PR, but happy to make one if one is needed. This will also need to be backported to 2.3.6.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)
@m2-assistant m2-assistant bot added Component: Captcha Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Jan 13, 2021
@m2-community-project m2-community-project bot added this to Pull Request In Progress in High Priority Backlog Jan 13, 2021
@engcom-Delta engcom-Delta self-assigned this Jan 25, 2021
@m2-assistant
Copy link
Author

m2-assistant bot commented Jan 25, 2021

Hi @engcom-Delta. 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-Delta engcom-Delta added Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Jan 25, 2021
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Delta
Thank you for verifying the issue. Based on the provided information internal tickets MC-40622 were created

Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Captcha Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
Development

Successfully merging a pull request may close this issue.

3 participants