Anz
Anz

Reputation: 222

Dealing with magento session time out

I want to display a warning message 2 minutes before timing out the customer login session, asking if they are still there. I set the cookie life time to 15 minutes, so after 13 minutes, I want to warn the user about the session time out. How to do this in magento ?

I would be pleased if anyone provide a clear cut idea. I am a newbie to magento.

Upvotes: 2

Views: 986

Answers (1)

Tim Bezhashvyly
Tim Bezhashvyly

Reputation: 9100

Add the following code at the bottom of your /add/design/frontend/[your-interface]/[your-theme]/page/html/head.phtml:

<script type="text/javascript">

 var t = setTimeout('areYouStillThere()', 3000);

 function areYouStillThere(){
  if(confirm('Session is expiring. Are you still there?')){
   location.reload();
  }
 }

</script>

You can improve it with prototype or jQuery if you want.

Upvotes: 6

Related Questions