I can not believe it is not possible to pass parameters to Devise’s timeout method… so I hope someone can enlighten me.
I have a Rails application with two mountable engines: A and B. Both engines share the same authentication system based on Devise. When a timeout occurs I need the following parameters to redirect to the correct page:
-
login_source: this is stored in the session and determines from which application the current user logged in (A or B).
-
customer’: the name of the customer. Different customers have different stylesheets. This can be obtained from the current user.
-
location’: which of the customer’s locations was used. This can also be obtained from the current user.
When the timeout method is called in my sessions controller, the session has already been killed. This leaves me only one option: to store the parameters in the cookies and retrieve them from there to redirect to the correct login page.
Ideally, I would like to get these parameters from somewhere else, as cookies are being restricted more and more. In the future, if the site is embedded in an iframe, I won’t even be able to get the parameters from the cookies, as they will be considered third-party cookies (Source).
pabvvv is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.