0

I tried to show a popup message when customer tried to login. I add some code in LoginPost.php like in code below but it's not work.

LoginPost.php :

try {
      echo "  <script type='text/javascript'>
              alert('adadasd'); //This code i tried to popup a message
              </script>";

      $customer = $this->customerAccountManagement->authenticate($jsonObject[0]->EMAILOWNER, $jsonObject[0]->PASSWORDOWNER);
      $this->session->setCustomerDataAsLoggedIn($customer);
      $this->session->regenerateId();
      setcookie("Role", $jsonObject[0]->ROLE, time() + (86400 * 30), "/");
      if ($this->getCookieManager()->getCookie('mage-cache-sessid')) {
         $metadata = $this->getCookieMetadataFactory()->createCookieMetadata();
         $metadata->setPath('/');
         $this->getCookieManager()->deleteCookie('mage-cache-sessid', $metadata);
      }

How can i show a popup there? So the login will not continue before the customer click the popup message?

6
  • Customer tried to login means? do u want to show popup when customer enters login page? Nov 3, 2017 at 4:43
  • No, when customer login from login page, there will be a popup on the login process, so after the popup clicked, the login process will continue. Nov 3, 2017 at 6:07
  • u need pop up with yes or no button right? Nov 3, 2017 at 6:12
  • Yes, can i add that popup on login process? Nov 3, 2017 at 6:13
  • yes u can done this by javascript Nov 3, 2017 at 6:15

1 Answer 1

0

Use this js code in your custom.js

require([ 'jquery', 'jquery/ui'], function($){
    jQuery('.action.login.primary').on('click',function(){
         confirm('Do you want to continue the process?');
    });
});
1
  • so the js should added in custom js? can i add it to the LoginPost.php? Nov 3, 2017 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.