How to override E:xampphtdocsmagevendormagentomodule-customerControllerAccount controller magento 2?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
1
down vote
favorite
Actually i am trying to override
E:xampphtdocsmagevendormagentomodule-customerControllerAccount
controller using custom module here i am trying to to override
$message = __(
'You did not sign in correctly or your account is temporarily disabled.'
);
this message
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoCustomerControllerAccount;
use MagentoCustomerModelAccountRedirect as AccountRedirect;
use MagentoFrameworkAppActionContext;
use MagentoCustomerModelSession;
use MagentoCustomerApiAccountManagementInterface;
use MagentoCustomerModelUrl as CustomerUrl;
use MagentoFrameworkExceptionEmailNotConfirmedException;
use MagentoFrameworkExceptionAuthenticationException;
use MagentoFrameworkDataFormFormKeyValidator;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkExceptionStateUserLockedException;
use MagentoFrameworkAppConfigScopeConfigInterface;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class LoginPost extends MagentoCustomerControllerAbstractAccount
/**
* @var MagentoCustomerApiAccountManagementInterface
*/
protected $customerAccountManagement;
/**
* @var MagentoFrameworkDataFormFormKeyValidator
*/
protected $formKeyValidator;
/**
* @var AccountRedirect
*/
protected $accountRedirect;
/**
* @var Session
*/
protected $session;
/**
* @var ScopeConfigInterface
*/
private $scopeConfig;
/**
* @var MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private $cookieMetadataFactory;
/**
* @var MagentoFrameworkStdlibCookiePhpCookieManager
*/
private $cookieMetadataManager;
/**
* @param Context $context
* @param Session $customerSession
* @param AccountManagementInterface $customerAccountManagement
* @param CustomerUrl $customerHelperData
* @param Validator $formKeyValidator
* @param AccountRedirect $accountRedirect
*/
public function __construct(
Context $context,
Session $customerSession,
AccountManagementInterface $customerAccountManagement,
CustomerUrl $customerHelperData,
Validator $formKeyValidator,
AccountRedirect $accountRedirect
)
$this->session = $customerSession;
$this->customerAccountManagement = $customerAccountManagement;
$this->customerUrl = $customerHelperData;
$this->formKeyValidator = $formKeyValidator;
$this->accountRedirect = $accountRedirect;
parent::__construct($context);
/**
* Get scope config
*
* @return ScopeConfigInterface
* @deprecated 100.0.10
*/
private function getScopeConfig()
if (!($this->scopeConfig instanceof MagentoFrameworkAppConfigScopeConfigInterface))
return MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkAppConfigScopeConfigInterface::class
);
else
return $this->scopeConfig;
/**
* Retrieve cookie manager
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookiePhpCookieManager
*/
private function getCookieManager()
if (!$this->cookieMetadataManager)
$this->cookieMetadataManager = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookiePhpCookieManager::class
);
return $this->cookieMetadataManager;
/**
* Retrieve cookie metadata factory
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private function getCookieMetadataFactory()
if (!$this->cookieMetadataFactory)
$this->cookieMetadataFactory = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookieCookieMetadataFactory::class
);
return $this->cookieMetadataFactory;
/**
* Login post action
*
* @return MagentoFrameworkControllerResultRedirect
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute()
if ($this->session->isLoggedIn()
magento2 overrides customer-account
add a comment |Â
up vote
1
down vote
favorite
Actually i am trying to override
E:xampphtdocsmagevendormagentomodule-customerControllerAccount
controller using custom module here i am trying to to override
$message = __(
'You did not sign in correctly or your account is temporarily disabled.'
);
this message
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoCustomerControllerAccount;
use MagentoCustomerModelAccountRedirect as AccountRedirect;
use MagentoFrameworkAppActionContext;
use MagentoCustomerModelSession;
use MagentoCustomerApiAccountManagementInterface;
use MagentoCustomerModelUrl as CustomerUrl;
use MagentoFrameworkExceptionEmailNotConfirmedException;
use MagentoFrameworkExceptionAuthenticationException;
use MagentoFrameworkDataFormFormKeyValidator;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkExceptionStateUserLockedException;
use MagentoFrameworkAppConfigScopeConfigInterface;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class LoginPost extends MagentoCustomerControllerAbstractAccount
/**
* @var MagentoCustomerApiAccountManagementInterface
*/
protected $customerAccountManagement;
/**
* @var MagentoFrameworkDataFormFormKeyValidator
*/
protected $formKeyValidator;
/**
* @var AccountRedirect
*/
protected $accountRedirect;
/**
* @var Session
*/
protected $session;
/**
* @var ScopeConfigInterface
*/
private $scopeConfig;
/**
* @var MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private $cookieMetadataFactory;
/**
* @var MagentoFrameworkStdlibCookiePhpCookieManager
*/
private $cookieMetadataManager;
/**
* @param Context $context
* @param Session $customerSession
* @param AccountManagementInterface $customerAccountManagement
* @param CustomerUrl $customerHelperData
* @param Validator $formKeyValidator
* @param AccountRedirect $accountRedirect
*/
public function __construct(
Context $context,
Session $customerSession,
AccountManagementInterface $customerAccountManagement,
CustomerUrl $customerHelperData,
Validator $formKeyValidator,
AccountRedirect $accountRedirect
)
$this->session = $customerSession;
$this->customerAccountManagement = $customerAccountManagement;
$this->customerUrl = $customerHelperData;
$this->formKeyValidator = $formKeyValidator;
$this->accountRedirect = $accountRedirect;
parent::__construct($context);
/**
* Get scope config
*
* @return ScopeConfigInterface
* @deprecated 100.0.10
*/
private function getScopeConfig()
if (!($this->scopeConfig instanceof MagentoFrameworkAppConfigScopeConfigInterface))
return MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkAppConfigScopeConfigInterface::class
);
else
return $this->scopeConfig;
/**
* Retrieve cookie manager
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookiePhpCookieManager
*/
private function getCookieManager()
if (!$this->cookieMetadataManager)
$this->cookieMetadataManager = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookiePhpCookieManager::class
);
return $this->cookieMetadataManager;
/**
* Retrieve cookie metadata factory
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private function getCookieMetadataFactory()
if (!$this->cookieMetadataFactory)
$this->cookieMetadataFactory = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookieCookieMetadataFactory::class
);
return $this->cookieMetadataFactory;
/**
* Login post action
*
* @return MagentoFrameworkControllerResultRedirect
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute()
if ($this->session->isLoggedIn()
magento2 overrides customer-account
Are you facing any issue?
– Rutvee Sojitra
7 hours ago
i am trying to override this message ''You did not sign in correctly or your account is temporarily disabled.''
– hitesh balpande
6 hours ago
1
@hiteshbalpande instead of overriding class, you should use translation.
– Ranjit Shinde
6 hours ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Actually i am trying to override
E:xampphtdocsmagevendormagentomodule-customerControllerAccount
controller using custom module here i am trying to to override
$message = __(
'You did not sign in correctly or your account is temporarily disabled.'
);
this message
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoCustomerControllerAccount;
use MagentoCustomerModelAccountRedirect as AccountRedirect;
use MagentoFrameworkAppActionContext;
use MagentoCustomerModelSession;
use MagentoCustomerApiAccountManagementInterface;
use MagentoCustomerModelUrl as CustomerUrl;
use MagentoFrameworkExceptionEmailNotConfirmedException;
use MagentoFrameworkExceptionAuthenticationException;
use MagentoFrameworkDataFormFormKeyValidator;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkExceptionStateUserLockedException;
use MagentoFrameworkAppConfigScopeConfigInterface;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class LoginPost extends MagentoCustomerControllerAbstractAccount
/**
* @var MagentoCustomerApiAccountManagementInterface
*/
protected $customerAccountManagement;
/**
* @var MagentoFrameworkDataFormFormKeyValidator
*/
protected $formKeyValidator;
/**
* @var AccountRedirect
*/
protected $accountRedirect;
/**
* @var Session
*/
protected $session;
/**
* @var ScopeConfigInterface
*/
private $scopeConfig;
/**
* @var MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private $cookieMetadataFactory;
/**
* @var MagentoFrameworkStdlibCookiePhpCookieManager
*/
private $cookieMetadataManager;
/**
* @param Context $context
* @param Session $customerSession
* @param AccountManagementInterface $customerAccountManagement
* @param CustomerUrl $customerHelperData
* @param Validator $formKeyValidator
* @param AccountRedirect $accountRedirect
*/
public function __construct(
Context $context,
Session $customerSession,
AccountManagementInterface $customerAccountManagement,
CustomerUrl $customerHelperData,
Validator $formKeyValidator,
AccountRedirect $accountRedirect
)
$this->session = $customerSession;
$this->customerAccountManagement = $customerAccountManagement;
$this->customerUrl = $customerHelperData;
$this->formKeyValidator = $formKeyValidator;
$this->accountRedirect = $accountRedirect;
parent::__construct($context);
/**
* Get scope config
*
* @return ScopeConfigInterface
* @deprecated 100.0.10
*/
private function getScopeConfig()
if (!($this->scopeConfig instanceof MagentoFrameworkAppConfigScopeConfigInterface))
return MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkAppConfigScopeConfigInterface::class
);
else
return $this->scopeConfig;
/**
* Retrieve cookie manager
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookiePhpCookieManager
*/
private function getCookieManager()
if (!$this->cookieMetadataManager)
$this->cookieMetadataManager = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookiePhpCookieManager::class
);
return $this->cookieMetadataManager;
/**
* Retrieve cookie metadata factory
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private function getCookieMetadataFactory()
if (!$this->cookieMetadataFactory)
$this->cookieMetadataFactory = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookieCookieMetadataFactory::class
);
return $this->cookieMetadataFactory;
/**
* Login post action
*
* @return MagentoFrameworkControllerResultRedirect
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute()
if ($this->session->isLoggedIn()
magento2 overrides customer-account
Actually i am trying to override
E:xampphtdocsmagevendormagentomodule-customerControllerAccount
controller using custom module here i am trying to to override
$message = __(
'You did not sign in correctly or your account is temporarily disabled.'
);
this message
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace MagentoCustomerControllerAccount;
use MagentoCustomerModelAccountRedirect as AccountRedirect;
use MagentoFrameworkAppActionContext;
use MagentoCustomerModelSession;
use MagentoCustomerApiAccountManagementInterface;
use MagentoCustomerModelUrl as CustomerUrl;
use MagentoFrameworkExceptionEmailNotConfirmedException;
use MagentoFrameworkExceptionAuthenticationException;
use MagentoFrameworkDataFormFormKeyValidator;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkExceptionStateUserLockedException;
use MagentoFrameworkAppConfigScopeConfigInterface;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class LoginPost extends MagentoCustomerControllerAbstractAccount
/**
* @var MagentoCustomerApiAccountManagementInterface
*/
protected $customerAccountManagement;
/**
* @var MagentoFrameworkDataFormFormKeyValidator
*/
protected $formKeyValidator;
/**
* @var AccountRedirect
*/
protected $accountRedirect;
/**
* @var Session
*/
protected $session;
/**
* @var ScopeConfigInterface
*/
private $scopeConfig;
/**
* @var MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private $cookieMetadataFactory;
/**
* @var MagentoFrameworkStdlibCookiePhpCookieManager
*/
private $cookieMetadataManager;
/**
* @param Context $context
* @param Session $customerSession
* @param AccountManagementInterface $customerAccountManagement
* @param CustomerUrl $customerHelperData
* @param Validator $formKeyValidator
* @param AccountRedirect $accountRedirect
*/
public function __construct(
Context $context,
Session $customerSession,
AccountManagementInterface $customerAccountManagement,
CustomerUrl $customerHelperData,
Validator $formKeyValidator,
AccountRedirect $accountRedirect
)
$this->session = $customerSession;
$this->customerAccountManagement = $customerAccountManagement;
$this->customerUrl = $customerHelperData;
$this->formKeyValidator = $formKeyValidator;
$this->accountRedirect = $accountRedirect;
parent::__construct($context);
/**
* Get scope config
*
* @return ScopeConfigInterface
* @deprecated 100.0.10
*/
private function getScopeConfig()
if (!($this->scopeConfig instanceof MagentoFrameworkAppConfigScopeConfigInterface))
return MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkAppConfigScopeConfigInterface::class
);
else
return $this->scopeConfig;
/**
* Retrieve cookie manager
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookiePhpCookieManager
*/
private function getCookieManager()
if (!$this->cookieMetadataManager)
$this->cookieMetadataManager = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookiePhpCookieManager::class
);
return $this->cookieMetadataManager;
/**
* Retrieve cookie metadata factory
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private function getCookieMetadataFactory()
if (!$this->cookieMetadataFactory)
$this->cookieMetadataFactory = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookieCookieMetadataFactory::class
);
return $this->cookieMetadataFactory;
/**
* Login post action
*
* @return MagentoFrameworkControllerResultRedirect
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute()
if ($this->session->isLoggedIn()
magento2 overrides customer-account
magento2 overrides customer-account
edited 6 hours ago


mrfizh
5851421
5851421
asked 7 hours ago


hitesh balpande
1308
1308
Are you facing any issue?
– Rutvee Sojitra
7 hours ago
i am trying to override this message ''You did not sign in correctly or your account is temporarily disabled.''
– hitesh balpande
6 hours ago
1
@hiteshbalpande instead of overriding class, you should use translation.
– Ranjit Shinde
6 hours ago
add a comment |Â
Are you facing any issue?
– Rutvee Sojitra
7 hours ago
i am trying to override this message ''You did not sign in correctly or your account is temporarily disabled.''
– hitesh balpande
6 hours ago
1
@hiteshbalpande instead of overriding class, you should use translation.
– Ranjit Shinde
6 hours ago
Are you facing any issue?
– Rutvee Sojitra
7 hours ago
Are you facing any issue?
– Rutvee Sojitra
7 hours ago
i am trying to override this message ''You did not sign in correctly or your account is temporarily disabled.''
– hitesh balpande
6 hours ago
i am trying to override this message ''You did not sign in correctly or your account is temporarily disabled.''
– hitesh balpande
6 hours ago
1
1
@hiteshbalpande instead of overriding class, you should use translation.
– Ranjit Shinde
6 hours ago
@hiteshbalpande instead of overriding class, you should use translation.
– Ranjit Shinde
6 hours ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
how about this :
in your di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCustomerControllerAccountLoginPost" type="CompanyModuleControllerAccountLoginPost" />
</config>
and now you can customize the message :
<?php
namespace CompanyModuleControllerAccount;
use MagentoCustomerModelAccountRedirect as AccountRedirect;
use MagentoFrameworkAppActionContext;
use MagentoCustomerModelSession;
use MagentoCustomerApiAccountManagementInterface;
use MagentoCustomerModelUrl as CustomerUrl;
use MagentoFrameworkExceptionEmailNotConfirmedException;
use MagentoFrameworkExceptionAuthenticationException;
use MagentoFrameworkDataFormFormKeyValidator;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkExceptionStateUserLockedException;
use MagentoFrameworkAppConfigScopeConfigInterface;
class LoginPost extends MagentoCustomerControllerAccountLoginPost
/**
* @var MagentoCustomerApiAccountManagementInterface
*/
protected $customerAccountManagement;
/**
* @var MagentoFrameworkDataFormFormKeyValidator
*/
protected $formKeyValidator;
/**
* @var AccountRedirect
*/
protected $accountRedirect;
/**
* @var Session
*/
protected $session;
/**
* @var ScopeConfigInterface
*/
private $scopeConfig;
/**
* @var MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private $cookieMetadataFactory;
/**
* @var MagentoFrameworkStdlibCookiePhpCookieManager
*/
private $cookieMetadataManager;
/**
* @param Context $context
* @param Session $customerSession
* @param AccountManagementInterface $customerAccountManagement
* @param CustomerUrl $customerHelperData
* @param Validator $formKeyValidator
* @param AccountRedirect $accountRedirect
*/
public function __construct(
Context $context,
Session $customerSession,
AccountManagementInterface $customerAccountManagement,
CustomerUrl $customerHelperData,
Validator $formKeyValidator,
AccountRedirect $accountRedirect
)
$this->session = $customerSession;
$this->customerAccountManagement = $customerAccountManagement;
$this->customerUrl = $customerHelperData;
$this->formKeyValidator = $formKeyValidator;
$this->accountRedirect = $accountRedirect;
parent::__construct($context);
/**
* Get scope config
*
* @return ScopeConfigInterface
* @deprecated 100.0.10
*/
private function getScopeConfig()
if (!($this->scopeConfig instanceof MagentoFrameworkAppConfigScopeConfigInterface))
return MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkAppConfigScopeConfigInterface::class
);
else
return $this->scopeConfig;
/**
* Retrieve cookie manager
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookiePhpCookieManager
*/
private function getCookieManager()
if (!$this->cookieMetadataManager)
$this->cookieMetadataManager = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookiePhpCookieManager::class
);
return $this->cookieMetadataManager;
/**
* Retrieve cookie metadata factory
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private function getCookieMetadataFactory()
if (!$this->cookieMetadataFactory)
$this->cookieMetadataFactory = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookieCookieMetadataFactory::class
);
return $this->cookieMetadataFactory;
/**
* Login post action
*
* @return MagentoFrameworkControllerResultRedirect
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute()
if ($this->session->isLoggedIn()
Fatal error: Cannot declare class MagentoCustomerControllerAccountLoginPost, because the name is already in use in E:xampphtdocsmageappcodeInkindNavdataControllerAccountLoginPost.php on line 205 error is showing
– hitesh balpande
4 hours ago
I see so you already custom extension that override LoginPost.php Class, just remove my answer question, and go toapp/code/Inkind/NavData/Controller/Account/LoginPost.php
just change error message that you want.
– mrfizh
4 hours ago
ok i understand
– hitesh balpande
4 hours ago
add a comment |Â
up vote
4
down vote
To change only error message you should use translations instead of file overriding.
You can add translations by creating csv file at following location
app/design/frontend/Vendorname/themename/i18n/en_US.csv
and change the message as you want.
"You did not sign in correctly or your account is temporarily disabled.","Your custom message."
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
how about this :
in your di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCustomerControllerAccountLoginPost" type="CompanyModuleControllerAccountLoginPost" />
</config>
and now you can customize the message :
<?php
namespace CompanyModuleControllerAccount;
use MagentoCustomerModelAccountRedirect as AccountRedirect;
use MagentoFrameworkAppActionContext;
use MagentoCustomerModelSession;
use MagentoCustomerApiAccountManagementInterface;
use MagentoCustomerModelUrl as CustomerUrl;
use MagentoFrameworkExceptionEmailNotConfirmedException;
use MagentoFrameworkExceptionAuthenticationException;
use MagentoFrameworkDataFormFormKeyValidator;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkExceptionStateUserLockedException;
use MagentoFrameworkAppConfigScopeConfigInterface;
class LoginPost extends MagentoCustomerControllerAccountLoginPost
/**
* @var MagentoCustomerApiAccountManagementInterface
*/
protected $customerAccountManagement;
/**
* @var MagentoFrameworkDataFormFormKeyValidator
*/
protected $formKeyValidator;
/**
* @var AccountRedirect
*/
protected $accountRedirect;
/**
* @var Session
*/
protected $session;
/**
* @var ScopeConfigInterface
*/
private $scopeConfig;
/**
* @var MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private $cookieMetadataFactory;
/**
* @var MagentoFrameworkStdlibCookiePhpCookieManager
*/
private $cookieMetadataManager;
/**
* @param Context $context
* @param Session $customerSession
* @param AccountManagementInterface $customerAccountManagement
* @param CustomerUrl $customerHelperData
* @param Validator $formKeyValidator
* @param AccountRedirect $accountRedirect
*/
public function __construct(
Context $context,
Session $customerSession,
AccountManagementInterface $customerAccountManagement,
CustomerUrl $customerHelperData,
Validator $formKeyValidator,
AccountRedirect $accountRedirect
)
$this->session = $customerSession;
$this->customerAccountManagement = $customerAccountManagement;
$this->customerUrl = $customerHelperData;
$this->formKeyValidator = $formKeyValidator;
$this->accountRedirect = $accountRedirect;
parent::__construct($context);
/**
* Get scope config
*
* @return ScopeConfigInterface
* @deprecated 100.0.10
*/
private function getScopeConfig()
if (!($this->scopeConfig instanceof MagentoFrameworkAppConfigScopeConfigInterface))
return MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkAppConfigScopeConfigInterface::class
);
else
return $this->scopeConfig;
/**
* Retrieve cookie manager
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookiePhpCookieManager
*/
private function getCookieManager()
if (!$this->cookieMetadataManager)
$this->cookieMetadataManager = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookiePhpCookieManager::class
);
return $this->cookieMetadataManager;
/**
* Retrieve cookie metadata factory
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private function getCookieMetadataFactory()
if (!$this->cookieMetadataFactory)
$this->cookieMetadataFactory = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookieCookieMetadataFactory::class
);
return $this->cookieMetadataFactory;
/**
* Login post action
*
* @return MagentoFrameworkControllerResultRedirect
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute()
if ($this->session->isLoggedIn()
Fatal error: Cannot declare class MagentoCustomerControllerAccountLoginPost, because the name is already in use in E:xampphtdocsmageappcodeInkindNavdataControllerAccountLoginPost.php on line 205 error is showing
– hitesh balpande
4 hours ago
I see so you already custom extension that override LoginPost.php Class, just remove my answer question, and go toapp/code/Inkind/NavData/Controller/Account/LoginPost.php
just change error message that you want.
– mrfizh
4 hours ago
ok i understand
– hitesh balpande
4 hours ago
add a comment |Â
up vote
1
down vote
accepted
how about this :
in your di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCustomerControllerAccountLoginPost" type="CompanyModuleControllerAccountLoginPost" />
</config>
and now you can customize the message :
<?php
namespace CompanyModuleControllerAccount;
use MagentoCustomerModelAccountRedirect as AccountRedirect;
use MagentoFrameworkAppActionContext;
use MagentoCustomerModelSession;
use MagentoCustomerApiAccountManagementInterface;
use MagentoCustomerModelUrl as CustomerUrl;
use MagentoFrameworkExceptionEmailNotConfirmedException;
use MagentoFrameworkExceptionAuthenticationException;
use MagentoFrameworkDataFormFormKeyValidator;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkExceptionStateUserLockedException;
use MagentoFrameworkAppConfigScopeConfigInterface;
class LoginPost extends MagentoCustomerControllerAccountLoginPost
/**
* @var MagentoCustomerApiAccountManagementInterface
*/
protected $customerAccountManagement;
/**
* @var MagentoFrameworkDataFormFormKeyValidator
*/
protected $formKeyValidator;
/**
* @var AccountRedirect
*/
protected $accountRedirect;
/**
* @var Session
*/
protected $session;
/**
* @var ScopeConfigInterface
*/
private $scopeConfig;
/**
* @var MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private $cookieMetadataFactory;
/**
* @var MagentoFrameworkStdlibCookiePhpCookieManager
*/
private $cookieMetadataManager;
/**
* @param Context $context
* @param Session $customerSession
* @param AccountManagementInterface $customerAccountManagement
* @param CustomerUrl $customerHelperData
* @param Validator $formKeyValidator
* @param AccountRedirect $accountRedirect
*/
public function __construct(
Context $context,
Session $customerSession,
AccountManagementInterface $customerAccountManagement,
CustomerUrl $customerHelperData,
Validator $formKeyValidator,
AccountRedirect $accountRedirect
)
$this->session = $customerSession;
$this->customerAccountManagement = $customerAccountManagement;
$this->customerUrl = $customerHelperData;
$this->formKeyValidator = $formKeyValidator;
$this->accountRedirect = $accountRedirect;
parent::__construct($context);
/**
* Get scope config
*
* @return ScopeConfigInterface
* @deprecated 100.0.10
*/
private function getScopeConfig()
if (!($this->scopeConfig instanceof MagentoFrameworkAppConfigScopeConfigInterface))
return MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkAppConfigScopeConfigInterface::class
);
else
return $this->scopeConfig;
/**
* Retrieve cookie manager
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookiePhpCookieManager
*/
private function getCookieManager()
if (!$this->cookieMetadataManager)
$this->cookieMetadataManager = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookiePhpCookieManager::class
);
return $this->cookieMetadataManager;
/**
* Retrieve cookie metadata factory
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private function getCookieMetadataFactory()
if (!$this->cookieMetadataFactory)
$this->cookieMetadataFactory = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookieCookieMetadataFactory::class
);
return $this->cookieMetadataFactory;
/**
* Login post action
*
* @return MagentoFrameworkControllerResultRedirect
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute()
if ($this->session->isLoggedIn()
Fatal error: Cannot declare class MagentoCustomerControllerAccountLoginPost, because the name is already in use in E:xampphtdocsmageappcodeInkindNavdataControllerAccountLoginPost.php on line 205 error is showing
– hitesh balpande
4 hours ago
I see so you already custom extension that override LoginPost.php Class, just remove my answer question, and go toapp/code/Inkind/NavData/Controller/Account/LoginPost.php
just change error message that you want.
– mrfizh
4 hours ago
ok i understand
– hitesh balpande
4 hours ago
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
how about this :
in your di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCustomerControllerAccountLoginPost" type="CompanyModuleControllerAccountLoginPost" />
</config>
and now you can customize the message :
<?php
namespace CompanyModuleControllerAccount;
use MagentoCustomerModelAccountRedirect as AccountRedirect;
use MagentoFrameworkAppActionContext;
use MagentoCustomerModelSession;
use MagentoCustomerApiAccountManagementInterface;
use MagentoCustomerModelUrl as CustomerUrl;
use MagentoFrameworkExceptionEmailNotConfirmedException;
use MagentoFrameworkExceptionAuthenticationException;
use MagentoFrameworkDataFormFormKeyValidator;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkExceptionStateUserLockedException;
use MagentoFrameworkAppConfigScopeConfigInterface;
class LoginPost extends MagentoCustomerControllerAccountLoginPost
/**
* @var MagentoCustomerApiAccountManagementInterface
*/
protected $customerAccountManagement;
/**
* @var MagentoFrameworkDataFormFormKeyValidator
*/
protected $formKeyValidator;
/**
* @var AccountRedirect
*/
protected $accountRedirect;
/**
* @var Session
*/
protected $session;
/**
* @var ScopeConfigInterface
*/
private $scopeConfig;
/**
* @var MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private $cookieMetadataFactory;
/**
* @var MagentoFrameworkStdlibCookiePhpCookieManager
*/
private $cookieMetadataManager;
/**
* @param Context $context
* @param Session $customerSession
* @param AccountManagementInterface $customerAccountManagement
* @param CustomerUrl $customerHelperData
* @param Validator $formKeyValidator
* @param AccountRedirect $accountRedirect
*/
public function __construct(
Context $context,
Session $customerSession,
AccountManagementInterface $customerAccountManagement,
CustomerUrl $customerHelperData,
Validator $formKeyValidator,
AccountRedirect $accountRedirect
)
$this->session = $customerSession;
$this->customerAccountManagement = $customerAccountManagement;
$this->customerUrl = $customerHelperData;
$this->formKeyValidator = $formKeyValidator;
$this->accountRedirect = $accountRedirect;
parent::__construct($context);
/**
* Get scope config
*
* @return ScopeConfigInterface
* @deprecated 100.0.10
*/
private function getScopeConfig()
if (!($this->scopeConfig instanceof MagentoFrameworkAppConfigScopeConfigInterface))
return MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkAppConfigScopeConfigInterface::class
);
else
return $this->scopeConfig;
/**
* Retrieve cookie manager
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookiePhpCookieManager
*/
private function getCookieManager()
if (!$this->cookieMetadataManager)
$this->cookieMetadataManager = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookiePhpCookieManager::class
);
return $this->cookieMetadataManager;
/**
* Retrieve cookie metadata factory
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private function getCookieMetadataFactory()
if (!$this->cookieMetadataFactory)
$this->cookieMetadataFactory = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookieCookieMetadataFactory::class
);
return $this->cookieMetadataFactory;
/**
* Login post action
*
* @return MagentoFrameworkControllerResultRedirect
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute()
if ($this->session->isLoggedIn()
how about this :
in your di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCustomerControllerAccountLoginPost" type="CompanyModuleControllerAccountLoginPost" />
</config>
and now you can customize the message :
<?php
namespace CompanyModuleControllerAccount;
use MagentoCustomerModelAccountRedirect as AccountRedirect;
use MagentoFrameworkAppActionContext;
use MagentoCustomerModelSession;
use MagentoCustomerApiAccountManagementInterface;
use MagentoCustomerModelUrl as CustomerUrl;
use MagentoFrameworkExceptionEmailNotConfirmedException;
use MagentoFrameworkExceptionAuthenticationException;
use MagentoFrameworkDataFormFormKeyValidator;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkExceptionStateUserLockedException;
use MagentoFrameworkAppConfigScopeConfigInterface;
class LoginPost extends MagentoCustomerControllerAccountLoginPost
/**
* @var MagentoCustomerApiAccountManagementInterface
*/
protected $customerAccountManagement;
/**
* @var MagentoFrameworkDataFormFormKeyValidator
*/
protected $formKeyValidator;
/**
* @var AccountRedirect
*/
protected $accountRedirect;
/**
* @var Session
*/
protected $session;
/**
* @var ScopeConfigInterface
*/
private $scopeConfig;
/**
* @var MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private $cookieMetadataFactory;
/**
* @var MagentoFrameworkStdlibCookiePhpCookieManager
*/
private $cookieMetadataManager;
/**
* @param Context $context
* @param Session $customerSession
* @param AccountManagementInterface $customerAccountManagement
* @param CustomerUrl $customerHelperData
* @param Validator $formKeyValidator
* @param AccountRedirect $accountRedirect
*/
public function __construct(
Context $context,
Session $customerSession,
AccountManagementInterface $customerAccountManagement,
CustomerUrl $customerHelperData,
Validator $formKeyValidator,
AccountRedirect $accountRedirect
)
$this->session = $customerSession;
$this->customerAccountManagement = $customerAccountManagement;
$this->customerUrl = $customerHelperData;
$this->formKeyValidator = $formKeyValidator;
$this->accountRedirect = $accountRedirect;
parent::__construct($context);
/**
* Get scope config
*
* @return ScopeConfigInterface
* @deprecated 100.0.10
*/
private function getScopeConfig()
if (!($this->scopeConfig instanceof MagentoFrameworkAppConfigScopeConfigInterface))
return MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkAppConfigScopeConfigInterface::class
);
else
return $this->scopeConfig;
/**
* Retrieve cookie manager
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookiePhpCookieManager
*/
private function getCookieManager()
if (!$this->cookieMetadataManager)
$this->cookieMetadataManager = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookiePhpCookieManager::class
);
return $this->cookieMetadataManager;
/**
* Retrieve cookie metadata factory
*
* @deprecated 100.1.0
* @return MagentoFrameworkStdlibCookieCookieMetadataFactory
*/
private function getCookieMetadataFactory()
if (!$this->cookieMetadataFactory)
$this->cookieMetadataFactory = MagentoFrameworkAppObjectManager::getInstance()->get(
MagentoFrameworkStdlibCookieCookieMetadataFactory::class
);
return $this->cookieMetadataFactory;
/**
* Login post action
*
* @return MagentoFrameworkControllerResultRedirect
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute()
if ($this->session->isLoggedIn()
answered 6 hours ago


mrfizh
5851421
5851421
Fatal error: Cannot declare class MagentoCustomerControllerAccountLoginPost, because the name is already in use in E:xampphtdocsmageappcodeInkindNavdataControllerAccountLoginPost.php on line 205 error is showing
– hitesh balpande
4 hours ago
I see so you already custom extension that override LoginPost.php Class, just remove my answer question, and go toapp/code/Inkind/NavData/Controller/Account/LoginPost.php
just change error message that you want.
– mrfizh
4 hours ago
ok i understand
– hitesh balpande
4 hours ago
add a comment |Â
Fatal error: Cannot declare class MagentoCustomerControllerAccountLoginPost, because the name is already in use in E:xampphtdocsmageappcodeInkindNavdataControllerAccountLoginPost.php on line 205 error is showing
– hitesh balpande
4 hours ago
I see so you already custom extension that override LoginPost.php Class, just remove my answer question, and go toapp/code/Inkind/NavData/Controller/Account/LoginPost.php
just change error message that you want.
– mrfizh
4 hours ago
ok i understand
– hitesh balpande
4 hours ago
Fatal error: Cannot declare class MagentoCustomerControllerAccountLoginPost, because the name is already in use in E:xampphtdocsmageappcodeInkindNavdataControllerAccountLoginPost.php on line 205 error is showing
– hitesh balpande
4 hours ago
Fatal error: Cannot declare class MagentoCustomerControllerAccountLoginPost, because the name is already in use in E:xampphtdocsmageappcodeInkindNavdataControllerAccountLoginPost.php on line 205 error is showing
– hitesh balpande
4 hours ago
I see so you already custom extension that override LoginPost.php Class, just remove my answer question, and go to
app/code/Inkind/NavData/Controller/Account/LoginPost.php
just change error message that you want.– mrfizh
4 hours ago
I see so you already custom extension that override LoginPost.php Class, just remove my answer question, and go to
app/code/Inkind/NavData/Controller/Account/LoginPost.php
just change error message that you want.– mrfizh
4 hours ago
ok i understand
– hitesh balpande
4 hours ago
ok i understand
– hitesh balpande
4 hours ago
add a comment |Â
up vote
4
down vote
To change only error message you should use translations instead of file overriding.
You can add translations by creating csv file at following location
app/design/frontend/Vendorname/themename/i18n/en_US.csv
and change the message as you want.
"You did not sign in correctly or your account is temporarily disabled.","Your custom message."
add a comment |Â
up vote
4
down vote
To change only error message you should use translations instead of file overriding.
You can add translations by creating csv file at following location
app/design/frontend/Vendorname/themename/i18n/en_US.csv
and change the message as you want.
"You did not sign in correctly or your account is temporarily disabled.","Your custom message."
add a comment |Â
up vote
4
down vote
up vote
4
down vote
To change only error message you should use translations instead of file overriding.
You can add translations by creating csv file at following location
app/design/frontend/Vendorname/themename/i18n/en_US.csv
and change the message as you want.
"You did not sign in correctly or your account is temporarily disabled.","Your custom message."
To change only error message you should use translations instead of file overriding.
You can add translations by creating csv file at following location
app/design/frontend/Vendorname/themename/i18n/en_US.csv
and change the message as you want.
"You did not sign in correctly or your account is temporarily disabled.","Your custom message."
answered 6 hours ago
Ranjit Shinde
348316
348316
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f246936%2fhow-to-override-e-xampp-htdocs-mage-vendor-magento-module-customer-controller-a%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Are you facing any issue?
– Rutvee Sojitra
7 hours ago
i am trying to override this message ''You did not sign in correctly or your account is temporarily disabled.''
– hitesh balpande
6 hours ago
1
@hiteshbalpande instead of overriding class, you should use translation.
– Ranjit Shinde
6 hours ago