Skip to content

Commit a651b31

Browse files
author
al.kravchuk
committed
magento/magento#18901: Forgot password form should not available while customer is logged in.
- redirect logged in customers to My Account.
1 parent 9d56ebe commit a651b31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/code/Magento/Customer/Controller/Account/ForgotPassword.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,17 @@ public function __construct(
4040
/**
4141
* Forgot customer password page
4242
*
43-
* @return \Magento\Framework\View\Result\Page
43+
* @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\View\Result\Page
4444
*/
4545
public function execute()
4646
{
47+
if ($this->session->isLoggedIn()) {
48+
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
49+
$resultRedirect = $this->resultRedirectFactory->create();
50+
$resultRedirect->setPath('*/*/');
51+
return $resultRedirect;
52+
}
53+
4754
/** @var \Magento\Framework\View\Result\Page $resultPage */
4855
$resultPage = $this->resultPageFactory->create();
4956
$resultPage->getLayout()->getBlock('forgotPassword')->setEmailValue($this->session->getForgottenEmail());

0 commit comments

Comments
 (0)