How to keep previous form page with input data after session out due to inactivity & re-login in Laravel 9

77 views Asked by At

I want to make my Laravel 9 project to easier for my users by keep the previously opened form/page to be reload again as it was, which had been redirected to login page because of session timeout due to inactivity.

Another scenario I want to handle the CSRF token also need to be refreshed, after the re-login on one browser tabs need to re-activate all other opened tabs with CSRF. Detailed example below, If I opened my project in 2 browser tabs (tab A, tab B). I filled tab A form inputs partially which is a ajax form and haven't used both the tabs for around 2.5 hours(SESSION_LIFETIME=120 already set & waited for that time to exceeded) and I refreshed the tab B then done re-logged in with the same user account.

After that I filled the tab B form balance inputs and pressed submit button returns me 419 -Page Expired or csrf token mismatched errors, which makes the data loss on the tab A

Could someone help me to how can I achieve this in Laravel 9?

0

There are 0 answers