Answer the question
In order to leave comments, you need to log in
How to submit a form after a long period of inactivity?
Problem: The user opens a tab with the site and forgets about it for a long time (let's say from 3 hours to 3 days).
Then he tries to submit the form, but it does not work (as far as I understand, the token has expired).
Possible Solution
Answer the question
In order to leave comments, you need to log in
You can use the specially made GeneaLabs/laravel-caffeine package for such purposes . It adds a script to the page that, after a certain interval, kicks the backend and extends the session.
It is correct that it throws you out of the session after a while. Your second option is not very secure.
It seems to me that it would be correct to make it so that every minute an ajax request is sent from the user with an update ("prolongation") of the session.
In addition, this option is very simple to implement. Well, or really, increase the life of the token, and that’s all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question