Step with name "security" does not exist, when login with existed user on checkout
Closed this issue · 2 comments
got error:
Step with name "security" does not exist
when logged with already registered user on checkout stage
Also i have checked on your live demo and getting same error
I have discover and see that you fave disabling security step on CheckoutProccessScenario.php line 24:
if (!is_object($this->container->get('security.context')->getToken()->getUser())) {
$builder->add('security', new Step\SecurityStep());
}
but it looks like logged user is staying on security step, that makes error
My quick solution was:
CheckoutProccessScenario.php line 24:
// if (!is_object($this->container->get('security.context')->getToken()->getUser())) {
$builder->add('security', new Step\SecurityStep());
// }
line 32:
->setDisplayRoute('sylius_sandbox_checkout_dispaly')
change to
->setDisplayRoute('sylius_sandbox_checkout_forward')
cause we have same template loading at display and forward action and registration step redirect fine to next step
Then added follow lines to SecurityStep.php line 37:
public function forwardAction(ProcessContextInterface $context)
{
$this->overrideSecurityTargetPath();
// added by me to lets go to next step if user already logged
if (is_object($this->container->get('security.context')->getToken()->getUser()) ) {
$context->complete();
}
// end
As said it was just quick solution, so may be you will fix it properly
I can confirm, I noticed that recently. I'll think about proper solution, I think that adding this "already logged user -> complete" thing should solve this, without swapping the routes. I'll check. Thanks for reporting!
This should be fixed now. :) Thanks again for noticing.