0

I am trying to add customer data programmatically but it's not saving from the controller(override core controller)

<?php

namespace ConversionBug\ExitIntent\Controller\Account;

class Index extends \Magento\Customer\Controller\Account\CreatePost
{   

    public function execute(){  
        if ($this->session->isLoggedIn() || !$this->registration->isAllowed()) {            
           // $resultRedirect->setPath('*/*/');
            return $resultRedirect;
        }        
        if (!$this->getRequest()->getPost()) {           
            $url = $this->urlModel->getUrl('*/*/create', ['_secure' => true]);
            $resultRedirect->setUrl($this->_redirect->error($url));
            return $resultRedirect;
        }       
        $user =  $this->getRequest()->getPost('login');            
        $userName = explode('@', $user['username']);        
        $userDetails['firstname'] = $userDetails['lastname'] = $userName[0];      
        $redirectUrl = $this->session->getBeforeAuthUrl();
        $password = $user['password'];
        $customer = $this->customerExtractor->extract('customer_account_create', $this->_request);         
        $customer = $this->accountManagement
                         ->createAccount($customer,$password, $redirectUrl); 
      }   

}
Payal Patel
  • 1,511
  • 1
  • 20
  • 40
Ramesh
  • 986
  • 1
  • 14
  • 38

0 Answers0