Magento 2 How to get customer info on resetpasswordpost controller?How to edit customer account confirmation link in emailFrontend Customer Session Expire But Product Price Not Update in MagentoTrying to login customer after registration, Customer logged in but page refresh destroy sessionMagento Customer created from code not login to the websiteHow to customize the customer account after login according to user groupMagento 2 override the cutomer account loginpost controllerProgramatically Log User Out [Magento 2]1.9 - Redirect customer group to CMS pageMagento 2 validate customer session with extra parametersMagento 2 Assign customer group name to externally calling JavaScript file variable
Would denouncing cheaters from an exam make me less likely to receive penalties?
Four ships at the ocean with the same distance
Appropriate conduit for several data cables underground over 300' run
Can Jimmy hang on his rope?
What is the meaning of "prairie-dog" in this sentence?
Tesco's Burger Relish Best Before End date number
What kind of Chinook helicopter/airplane hybrid is this?
Is it okay to use open source code to do an interview task?
What is the relationship between external and internal composition in a cartesian closed category?
Is "wissen" the only verb in German to have an irregular present tense?
As a supervisor, what feedback would you expect from a PhD who quits?
My professor has told me he will be the corresponding author. Will it hurt my future career?
Writing an ace/aro character?
What does the multimeter dial do internally?
When do flights get cancelled due to fog?
Is it possible for a character at any level to cast all 44 Cantrips in one week without Magic Items?
How was the website able to tell my credit card was wrong before it processed it?
What exactly is a "murder hobo"?
What is the average number of draws it takes before you can not draw any more cards from the Deck of Many Things?
Passwordless authentication - how and when to invalidate a login code
Why the Cauchy Distribution is so useful?
How to understand flavors and when to use combination of them?
Matrices with shadows
Is it ok for parents to kiss and romance with each other while their 2- to 8-year-old child watches?
Magento 2 How to get customer info on resetpasswordpost controller?
How to edit customer account confirmation link in emailFrontend Customer Session Expire But Product Price Not Update in MagentoTrying to login customer after registration, Customer logged in but page refresh destroy sessionMagento Customer created from code not login to the websiteHow to customize the customer account after login according to user groupMagento 2 override the cutomer account loginpost controllerProgramatically Log User Out [Magento 2]1.9 - Redirect customer group to CMS pageMagento 2 validate customer session with extra parametersMagento 2 Assign customer group name to externally calling JavaScript file variable
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Magento 2 How to get customer info on customer/account/resetpasswordpost
controller?
I am trying this code -
echo "<pre>";
print_r($this->session->getData());
and getting this response only -
Array
(
[wishlist_item_count] => 0
[rp_token] => XH3BujdKNmcJpc1GQbChU8oYQbwTtiYv
[no_referer] => 1
)
I need to redirect to my custom pages according to customer needs.
For example -
If customer group is 1 then redirect to xyz page.
If customer group is 2 then redirect to abc page.
customer-account magento2.3.1 customer-group customer-session forgot-password
add a comment |
Magento 2 How to get customer info on customer/account/resetpasswordpost
controller?
I am trying this code -
echo "<pre>";
print_r($this->session->getData());
and getting this response only -
Array
(
[wishlist_item_count] => 0
[rp_token] => XH3BujdKNmcJpc1GQbChU8oYQbwTtiYv
[no_referer] => 1
)
I need to redirect to my custom pages according to customer needs.
For example -
If customer group is 1 then redirect to xyz page.
If customer group is 2 then redirect to abc page.
customer-account magento2.3.1 customer-group customer-session forgot-password
add a comment |
Magento 2 How to get customer info on customer/account/resetpasswordpost
controller?
I am trying this code -
echo "<pre>";
print_r($this->session->getData());
and getting this response only -
Array
(
[wishlist_item_count] => 0
[rp_token] => XH3BujdKNmcJpc1GQbChU8oYQbwTtiYv
[no_referer] => 1
)
I need to redirect to my custom pages according to customer needs.
For example -
If customer group is 1 then redirect to xyz page.
If customer group is 2 then redirect to abc page.
customer-account magento2.3.1 customer-group customer-session forgot-password
Magento 2 How to get customer info on customer/account/resetpasswordpost
controller?
I am trying this code -
echo "<pre>";
print_r($this->session->getData());
and getting this response only -
Array
(
[wishlist_item_count] => 0
[rp_token] => XH3BujdKNmcJpc1GQbChU8oYQbwTtiYv
[no_referer] => 1
)
I need to redirect to my custom pages according to customer needs.
For example -
If customer group is 1 then redirect to xyz page.
If customer group is 2 then redirect to abc page.
customer-account magento2.3.1 customer-group customer-session forgot-password
customer-account magento2.3.1 customer-group customer-session forgot-password
edited Jul 1 at 9:25
Raj Mohan R
1,3983 silver badges12 bronze badges
1,3983 silver badges12 bronze badges
asked Jun 29 at 12:27
sumeet bajajsumeet bajaj
19311 bronze badges
19311 bronze badges
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
You can get customer id in ResetPasswordPost controller by following code:
$this->session->getId();
And if you want customer data then use below code:
$this->session->getCustomerData();
You can load customer by id as below:
protected $_customer;
public function __construct(
MagentoCustomerModelCustomer $customer,
MagentoBackendBlockTemplateContext $context
)
$this->_customer = $customer;
parent::__construct($context);
public function getCustomer()
$customerId = '3'; //You customer ID
$customer = $this->_customer->getCollection()->addAttributeToFilter('entity_id', array('eq' => '3'));
print_r($customer->getData());//Customer data by customer ID
$customerId = '3'; //You customer ID how to get this dynamically ?
– sumeet bajaj
Jun 29 at 13:00
$this->session->getId(); it is printing 0
– sumeet bajaj
Jun 29 at 13:20
add a comment |
Load customer from Id
$customerId = (int)$this->getRequest()->getQuery('id');
$customer = $this->customerRepository->getById($customerId);
if($customer->getGroupId()==2)
$this->_redirect('customer/account/');
else
$this->_redirect('customer/account/');
$customerId = (int)$this->getRequest()->getQuery('id'); it is nothing print
– sumeet bajaj
Jun 29 at 13:20
that is customer id or you can get id from current customer session
– MageCoder
Jun 29 at 13:39
$this->session->getId(); i tried this but it is print 0
– sumeet bajaj
Jun 29 at 13:40
add a comment |
Finally i solved myself for now using that code -
$sessionData = $this->session->getData();
$customRpToken = $sessionData['rp_token'];
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
$connection = $resource->getConnection();
$tableName = $resource->getTableName('customer_entity');
$sql = "SELECT * FROM customer_entity WHERE rp_token = '".$customRpToken."'";
$result = $connection->fetchAll($sql);
$groupId = $result[0]['group_id'];
if($groupId == 4)
$resultRedirect->setPath('xyz');
else
$resultRedirect->setPath('*/*/login');
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f280182%2fmagento-2-how-to-get-customer-info-on-resetpasswordpost-controller%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can get customer id in ResetPasswordPost controller by following code:
$this->session->getId();
And if you want customer data then use below code:
$this->session->getCustomerData();
You can load customer by id as below:
protected $_customer;
public function __construct(
MagentoCustomerModelCustomer $customer,
MagentoBackendBlockTemplateContext $context
)
$this->_customer = $customer;
parent::__construct($context);
public function getCustomer()
$customerId = '3'; //You customer ID
$customer = $this->_customer->getCollection()->addAttributeToFilter('entity_id', array('eq' => '3'));
print_r($customer->getData());//Customer data by customer ID
$customerId = '3'; //You customer ID how to get this dynamically ?
– sumeet bajaj
Jun 29 at 13:00
$this->session->getId(); it is printing 0
– sumeet bajaj
Jun 29 at 13:20
add a comment |
You can get customer id in ResetPasswordPost controller by following code:
$this->session->getId();
And if you want customer data then use below code:
$this->session->getCustomerData();
You can load customer by id as below:
protected $_customer;
public function __construct(
MagentoCustomerModelCustomer $customer,
MagentoBackendBlockTemplateContext $context
)
$this->_customer = $customer;
parent::__construct($context);
public function getCustomer()
$customerId = '3'; //You customer ID
$customer = $this->_customer->getCollection()->addAttributeToFilter('entity_id', array('eq' => '3'));
print_r($customer->getData());//Customer data by customer ID
$customerId = '3'; //You customer ID how to get this dynamically ?
– sumeet bajaj
Jun 29 at 13:00
$this->session->getId(); it is printing 0
– sumeet bajaj
Jun 29 at 13:20
add a comment |
You can get customer id in ResetPasswordPost controller by following code:
$this->session->getId();
And if you want customer data then use below code:
$this->session->getCustomerData();
You can load customer by id as below:
protected $_customer;
public function __construct(
MagentoCustomerModelCustomer $customer,
MagentoBackendBlockTemplateContext $context
)
$this->_customer = $customer;
parent::__construct($context);
public function getCustomer()
$customerId = '3'; //You customer ID
$customer = $this->_customer->getCollection()->addAttributeToFilter('entity_id', array('eq' => '3'));
print_r($customer->getData());//Customer data by customer ID
You can get customer id in ResetPasswordPost controller by following code:
$this->session->getId();
And if you want customer data then use below code:
$this->session->getCustomerData();
You can load customer by id as below:
protected $_customer;
public function __construct(
MagentoCustomerModelCustomer $customer,
MagentoBackendBlockTemplateContext $context
)
$this->_customer = $customer;
parent::__construct($context);
public function getCustomer()
$customerId = '3'; //You customer ID
$customer = $this->_customer->getCollection()->addAttributeToFilter('entity_id', array('eq' => '3'));
print_r($customer->getData());//Customer data by customer ID
answered Jun 29 at 12:32
Saurabh DwivediSaurabh Dwivedi
8662 silver badges9 bronze badges
8662 silver badges9 bronze badges
$customerId = '3'; //You customer ID how to get this dynamically ?
– sumeet bajaj
Jun 29 at 13:00
$this->session->getId(); it is printing 0
– sumeet bajaj
Jun 29 at 13:20
add a comment |
$customerId = '3'; //You customer ID how to get this dynamically ?
– sumeet bajaj
Jun 29 at 13:00
$this->session->getId(); it is printing 0
– sumeet bajaj
Jun 29 at 13:20
$customerId = '3'; //You customer ID how to get this dynamically ?
– sumeet bajaj
Jun 29 at 13:00
$customerId = '3'; //You customer ID how to get this dynamically ?
– sumeet bajaj
Jun 29 at 13:00
$this->session->getId(); it is printing 0
– sumeet bajaj
Jun 29 at 13:20
$this->session->getId(); it is printing 0
– sumeet bajaj
Jun 29 at 13:20
add a comment |
Load customer from Id
$customerId = (int)$this->getRequest()->getQuery('id');
$customer = $this->customerRepository->getById($customerId);
if($customer->getGroupId()==2)
$this->_redirect('customer/account/');
else
$this->_redirect('customer/account/');
$customerId = (int)$this->getRequest()->getQuery('id'); it is nothing print
– sumeet bajaj
Jun 29 at 13:20
that is customer id or you can get id from current customer session
– MageCoder
Jun 29 at 13:39
$this->session->getId(); i tried this but it is print 0
– sumeet bajaj
Jun 29 at 13:40
add a comment |
Load customer from Id
$customerId = (int)$this->getRequest()->getQuery('id');
$customer = $this->customerRepository->getById($customerId);
if($customer->getGroupId()==2)
$this->_redirect('customer/account/');
else
$this->_redirect('customer/account/');
$customerId = (int)$this->getRequest()->getQuery('id'); it is nothing print
– sumeet bajaj
Jun 29 at 13:20
that is customer id or you can get id from current customer session
– MageCoder
Jun 29 at 13:39
$this->session->getId(); i tried this but it is print 0
– sumeet bajaj
Jun 29 at 13:40
add a comment |
Load customer from Id
$customerId = (int)$this->getRequest()->getQuery('id');
$customer = $this->customerRepository->getById($customerId);
if($customer->getGroupId()==2)
$this->_redirect('customer/account/');
else
$this->_redirect('customer/account/');
Load customer from Id
$customerId = (int)$this->getRequest()->getQuery('id');
$customer = $this->customerRepository->getById($customerId);
if($customer->getGroupId()==2)
$this->_redirect('customer/account/');
else
$this->_redirect('customer/account/');
answered Jun 29 at 12:36
MageCoderMageCoder
467 bronze badges
467 bronze badges
$customerId = (int)$this->getRequest()->getQuery('id'); it is nothing print
– sumeet bajaj
Jun 29 at 13:20
that is customer id or you can get id from current customer session
– MageCoder
Jun 29 at 13:39
$this->session->getId(); i tried this but it is print 0
– sumeet bajaj
Jun 29 at 13:40
add a comment |
$customerId = (int)$this->getRequest()->getQuery('id'); it is nothing print
– sumeet bajaj
Jun 29 at 13:20
that is customer id or you can get id from current customer session
– MageCoder
Jun 29 at 13:39
$this->session->getId(); i tried this but it is print 0
– sumeet bajaj
Jun 29 at 13:40
$customerId = (int)$this->getRequest()->getQuery('id'); it is nothing print
– sumeet bajaj
Jun 29 at 13:20
$customerId = (int)$this->getRequest()->getQuery('id'); it is nothing print
– sumeet bajaj
Jun 29 at 13:20
that is customer id or you can get id from current customer session
– MageCoder
Jun 29 at 13:39
that is customer id or you can get id from current customer session
– MageCoder
Jun 29 at 13:39
$this->session->getId(); i tried this but it is print 0
– sumeet bajaj
Jun 29 at 13:40
$this->session->getId(); i tried this but it is print 0
– sumeet bajaj
Jun 29 at 13:40
add a comment |
Finally i solved myself for now using that code -
$sessionData = $this->session->getData();
$customRpToken = $sessionData['rp_token'];
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
$connection = $resource->getConnection();
$tableName = $resource->getTableName('customer_entity');
$sql = "SELECT * FROM customer_entity WHERE rp_token = '".$customRpToken."'";
$result = $connection->fetchAll($sql);
$groupId = $result[0]['group_id'];
if($groupId == 4)
$resultRedirect->setPath('xyz');
else
$resultRedirect->setPath('*/*/login');
add a comment |
Finally i solved myself for now using that code -
$sessionData = $this->session->getData();
$customRpToken = $sessionData['rp_token'];
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
$connection = $resource->getConnection();
$tableName = $resource->getTableName('customer_entity');
$sql = "SELECT * FROM customer_entity WHERE rp_token = '".$customRpToken."'";
$result = $connection->fetchAll($sql);
$groupId = $result[0]['group_id'];
if($groupId == 4)
$resultRedirect->setPath('xyz');
else
$resultRedirect->setPath('*/*/login');
add a comment |
Finally i solved myself for now using that code -
$sessionData = $this->session->getData();
$customRpToken = $sessionData['rp_token'];
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
$connection = $resource->getConnection();
$tableName = $resource->getTableName('customer_entity');
$sql = "SELECT * FROM customer_entity WHERE rp_token = '".$customRpToken."'";
$result = $connection->fetchAll($sql);
$groupId = $result[0]['group_id'];
if($groupId == 4)
$resultRedirect->setPath('xyz');
else
$resultRedirect->setPath('*/*/login');
Finally i solved myself for now using that code -
$sessionData = $this->session->getData();
$customRpToken = $sessionData['rp_token'];
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
$connection = $resource->getConnection();
$tableName = $resource->getTableName('customer_entity');
$sql = "SELECT * FROM customer_entity WHERE rp_token = '".$customRpToken."'";
$result = $connection->fetchAll($sql);
$groupId = $result[0]['group_id'];
if($groupId == 4)
$resultRedirect->setPath('xyz');
else
$resultRedirect->setPath('*/*/login');
answered Jun 29 at 15:05
sumeet bajajsumeet bajaj
19311 bronze badges
19311 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f280182%2fmagento-2-how-to-get-customer-info-on-resetpasswordpost-controller%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown