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

Redirect loop when changing e-mail during guest checkout #1452

Closed
lars-feyerabend opened this issue Oct 26, 2020 · 3 comments
Closed

Redirect loop when changing e-mail during guest checkout #1452

lars-feyerabend opened this issue Oct 26, 2020 · 3 comments

Comments

@lars-feyerabend
Copy link

Description

Steps to reproduce:

  • Put random item into cart
  • Start checkout
  • Choose guest checkout on /checkout/register page
  • On /checkout/confirm notice that your email address is wrong
  • Click browser back button
  • Change email in form
  • Submit

Expected behaviour:

  • A new guest account/session is created with the newly entered email and the customer is again on /checkout/confirm

Actual behaviour:

  • A redirect loop occurs

Possible Solution

My proposed solution to break this cycle would be to change the first check in \Shopware\Storefront\Controller\RegisterController::register as follows:

if ($context->getCustomer() && !$context->getCustomer()->getGuest()) {
    return $this->redirectToRoute('frontend.account.home.page');
}

A more detailed look into the handling of the various steps with regards to guest account handling couldn't hurt though.

Additional context

The redirect is triggered in \Shopware\Storefront\Controller\RegisterController::register, where if ($context->getCustomer()) leads to a redirect to frontend.account.home.page regardless of whether it's a guest account or not. \Shopware\Storefront\Controller\AccountProfileController::index(the target action) however starts with $this->denyAccessUnlessLoggedIn(); (default parameter $allowGuest = false), which redirects to the Login page, but \Shopware\Storefront\Controller\AuthController::loginPage again only checks for if ($context->getCustomer()) and redirects back to the account page - the endless loop begins. (The redirectTo parameter of the login page is set to the account page when the \Shopware\Core\Checkout\Cart\Exception\CustomerNotLoggedInException is handled in \Shopware\Storefront\Framework\Routing\StorefrontSubscriber::customerNotLoggedInHandler)

@lars-feyerabend
Copy link
Author

Added in Shopware issue tracker: https://issues.shopware.com/issues/NEXT-11790

@lernhart
Copy link
Member

lernhart commented Dec 3, 2021

Hey @lars-feyerabend, thank you for reporting this, and sorry for the late response.
I'm closing this issue, as this landed in our triage and we can not reproduce this on current shopware release.

@lernhart lernhart closed this as completed Dec 3, 2021
@mstegmeyer
Copy link
Contributor

This issue has since been fixed by Shopware. https://issues.shopware.com/issues/NEXT-17938

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants