Jump to content

Log out when window browser is closed


lonasito

Recommended Posts

Hello,

 

I am trying to create a function that will automatically log user out of PrestaShop when browser window is closed. Ideally it should all happen in JS with possibly an AJAX call.

 

I already looked at this thread: http://www.prestashop.com/forums/topic/120515-logout-when-browser-is-closed/

 

Unfortunatelly, i wasn't able to implement this solution successfully. Can anyone help with that issue please? Perhaps there are other methods available.

Link to comment
Share on other sites

Probably you need to use cookie or you own variable in you module, for example save there current session ID and when user get back see if this changed

 

May be Prestashop do it for you and you just need to investigate cookie object for see what is in there.

 

But its bad practice, because is very annoying if you need always sign in....

 

Hope its helps.

Link to comment
Share on other sites

Problem is with even if you put your cookie to be a session cookie, Chrome and Firefox will keep it and reuse it after the browser has been closed, BUT the user has indicated to 'continue from last session'. Then the browser will do as if it still is the same session...

 

(Done, because Chrome, and lately Firefox auto update and restart the browser after an upgrade, and they didn't want the user to have to log in after this...)

 

:-(

Link to comment
Share on other sites

  • 9 months later...
  • 3 months later...

 

For people looking for solution for 1.6 version

 

 

change the setexpire to this

    public function setExpire($expire)
    {
        $this->_expire = 0;
    }

 

it's no use, i've changed $this->_expire to 0 , but still got the cookies even after i closed the browser...

 

any other reference ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...