Skip to content

Commit 76d478f

Browse files
author
Oleksii Gorbulin
committed
18901-Forgot-password-form-should-not-available-while-customer-is-logged-in
#18901: Forgot password form should not available while customer is logged in
1 parent da1a96c commit 76d478f

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
@@ -41,10 +41,17 @@ public function __construct(
4141
/**
4242
* Forgot customer password page
4343
*
44-
* @return \Magento\Framework\View\Result\Page
44+
* @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\View\Result\Page
4545
*/
4646
public function execute()
4747
{
48+
if ($this->session->isLoggedIn()) {
49+
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
50+
$resultRedirect = $this->resultRedirectFactory->create();
51+
$resultRedirect->setPath('*/*/');
52+
return $resultRedirect;
53+
}
54+
4855
/** @var \Magento\Framework\View\Result\Page $resultPage */
4956
$resultPage = $this->resultPageFactory->create();
5057
$resultPage->getLayout()->getBlock('forgotPassword')->setEmailValue($this->session->getForgottenEmail());

0 commit comments

Comments
 (0)