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

                    Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

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

                    Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form