I am trying to redirect to custom URL by using plugin feature of Magento 2 but somehow I am not able to redirect it. For this, I tried a couple of options like,
Magento2: redirection from Observer
Magento2: Redirect Using Plugin (With Website Restrictions ON)
But couldn't succeed with this. I am able to do it If I am adding exit();
after redirect method but it is not good practice to write exit();
. Do anyone have some hint on this?
I am using around
plugin and before plugin
I have written a plugin on Magento\Customer\Model\AccountManagement
class.
Thanks
Best Answer
As per as, our discussion, I am sharing an idea that might help you.
controller_action_postdispatch_customer_account_forgotPasswordPost
event catch that registry variable value, that pageCreate Plugin over
initiatePasswordReset
call and use after, before ,around method depend on your choose.Here, i am using around method.
Now,
controller_action_postdispatch_customer_account_forgotPasswordPost
event,redirect that URL
my_custom_redirect
.