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;








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.










share|improve this question






























    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.










    share|improve this question


























      0












      0








      0


      1






      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.










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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




















          3 Answers
          3






          active

          oldest

          votes


















          0














          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






          share|improve this answer























          • $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


















          0














          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/');






          share|improve this answer























          • $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


















          0














          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');






          share|improve this answer

























            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
            );



            );













            draft saved

            draft discarded


















            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









            0














            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






            share|improve this answer























            • $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















            0














            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






            share|improve this answer























            • $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













            0












            0








            0







            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






            share|improve this answer













            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







            share|improve this answer












            share|improve this answer



            share|improve this answer










            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

















            • $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













            0














            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/');






            share|improve this answer























            • $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















            0














            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/');






            share|improve this answer























            • $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













            0












            0








            0







            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/');






            share|improve this answer













            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/');







            share|improve this answer












            share|improve this answer



            share|improve this answer










            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

















            • $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











            0














            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');






            share|improve this answer



























              0














              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');






              share|improve this answer

























                0












                0








                0







                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');






                share|improve this answer













                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');







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jun 29 at 15:05









                sumeet bajajsumeet bajaj

                19311 bronze badges




                19311 bronze badges



























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                    Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?