0

Our Magento frontend is in vue storefront, so we have restricted default Magento frontend URLs for our system. But I need one URL of frontend which is

http://127.0.0.1/index.php/customer/account/createpassword/

I allowed it using observer:

<event name="controller_action_predispatch">`

and allowed frontname as:

if($routname!="customer" ) {

    $this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
    $this->redirect->redirect($controller->getResponse(),$this->HelperBackend->getHomePageUrl());

}

But the problem is after a user set his password he is redirected to this URL:

http://127.0.0.1/index.php/customer/account/login/

I don't want the user to see this URL. Instead, he should be redirected to vue storefront URL or backend URL or any customer url. How can I do this? Thanks

Update:

I tried doing like this

if ($routname!="customer") {
    if ($controllerName!="account") {
        if ($actionName!="createPassword") {
        $this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
        $this->redirect->redirect($controller->getResponse(),$this->HelperBackend->getHomePageUrl());
    }
    }
}

Still I can access all the actions under frontname "customer". I want only "createPassword" action!

1 Answer 1

0

Did it using this condition:

If ( !( $route == 'customer' && $controller == 'account' && strtolower($action) == 'createpassword' )) {
//redirect logic here
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.