How to get magento customer session logout time - magento

I want to create an app , which brings a pop-up when the customer session is about to expire.
So for this purpose I will be requiring customer session value .
Please help .
Thanks .

You cant check session remaining time. Because whenever you access the system session will be automatically refreshed. You can check only that session is available or expire. And There is no php function to get it. But We can do it by ajax. For example your session expire time is 30min. Set ajax for every page get refreshed and calculate that time with minus the 30min. And show your pop up message at what time (remaining time ) you want..!!

Related

Laravel 5.8 Login customization for individual user session lifetime

Following situation.
From Monday to Friday, between 8am and 7pm the session liftime for every user is rest minutes till 7pm. after 7pm session lifetime 15 Minutes. I find a solution to create a middleware and set config(['session.liftetime'].....) before the session is created. it works, but for every user.
After consulting the customer he want now the option in the login form, that the user can activate this function. so i need now customization the login and transfer the request infos of the form option to my middleware.
how can i solve this problem?
Thanks for every help

Laravel 5.4 logout event from session inactivity

I’m using file sessions and trying to capture when a user is logged out. Not when they click the button to logout, but when they have left the page still logged in. I have an event listener setup for logout, but that does not seem to fire. Does anyone know how to capture or create an event when the session logout occurs.
Illuminate\Auth\Events\Logout' => ['App\Listeners\LogSuccessfulLogout',],
The session timeout happens on the client side so you won't be able to detect when that happens.
The best you can do is keep an activity log of each user and on each request, store a timestamp for that user. Then you'd be able to determine whose sessions are expiring by adding the lifetime variable in session.php Config::get('session.lifetime') to the latest timestamp in your activity table and comparing that to the current time.
If it's greater than or equal to the current time, you know their session has expired.
You'd likely need to setup a global middleware which updates your activity table which contains at minimum a user_id column and a timestamp column after each request for logged in users.
Then you'd want to setup a job which runs every minute or so which reads from your activity table, grabs the config value in session.php, and fire's the user logout event for each user it determines has the session expiring. When that starts firing, your 'App\Listeners\LogSuccessfulLogout' listener should start picking up that event.

How to perform action when woocommerce cart cleared by expired session?

I have set up custom session expiration times to be 5 minutes. I am making custom seat information unavailable when a WC product that is a seat is added to cart.
I was able to get the cart to clear when session expire in 5 minutes but I am not able to run an action to make that same seat available back again during cart cleaning process upon session expiration.
The actions "woocommerce_cart_emptied" "woocommerce_cart_item_removed" "woocommerce_remove_cart_item" doesnt seem to be run when the cart is cleared by expired session. Does any of you know how to perform a function when cart clear upon expired session?
You can try following hook woocommerce_cleanup_sessions

how can i make a frontend login that will never expire in magento?

I want to make a login on the frontend of magento, that doesn't depend on a session, because I don't want it to expire, ever.
Probably this will go with cookies, but how?
If I use sessions, it will expire when the browser closes
In PHP sessions are based on cookies. Session identifier is stored in user's cookie. You can't set a session to live forever but you can set it for a very long period (for example for 1 year). You can adjust cookie life time in Magento admin area (System->General->Web->Session Cookie Management->Cookie Lifetime). You should set a value in seconds, so for 1 year it will be 31536000. But you should keep in mind that it will get some amount of space too keep sessions and also if you store session in filesystem you shouldn't delete folder var/session or you'll loose all users sessions.

CodeIgniter Session Expires on Page Refresh

We have a CodeIgniter based SAAS application. Sessions are stored in the database.
We use this class as a replacement for CI sessions
With one specific customer ( same office, multiple users, same IP ), the session is getting reset or destroyed on a page refresh.
This has never happened before with any other users or from other location. I am not able to reproduce this issue.
Steps:
User Logs in & sees home Page.
User begins navigation by clicking some link
Session times out and they are prompted to login again
And this continues after each login.
Session expiration is set to 3000 s and time_reference is GMT and sess_time_to_update = 300 s.
Any help on how to go about investigating this issue will help.
This happens in IE , Chrome and therefore does not seem to be a browser issue.
This same set of users have never had this issue before.
check the size of the session cookie. maybe it is larger than the allowed size > 4096. I know it's a long shot, but try it out nevertheless.

Resources