Redirect to Login Page on Session Expiration #1604

Open
opened 2026-02-05 01:23:55 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @EHLO1 on GitHub (Mar 20, 2020).

Describe the bug
Might not be a bug! If it's not, we can make this a feature request?

I have the following configured in the .env:
SESSION_LIFETIME=120
SESSION_COOKIE_NAME=bookstack_session
SESSION_SECURE_COOKIE=true

Those settings work great, however, when a user's session expires, nothing happens. As an example, a user is writing a page, locks their computer and leaves for the day, then returns the next day to the same screen. They continue typing, but the moment they hit save or navigate anywhere else, THEN they get returned to the login page.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Configure the session settings in .env
  2. Login and wait for the session to expire.
  3. Notice that nothing has changed.
  4. Try to navigate anywhere and then get returned to the login page.

Expected behavior
When a user's session expires, they should be returned to the login page.

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): v0.28.2
  • PHP Version: 7.3.14
  • Hosting Method (Nginx/Apache/Docker): Linuxserver.io Docker Container (Nginx)

If this issue should be taken up with Linuxserver.io, I will post it there instead. Thanks for any assistance you can provide!

Originally created by @EHLO1 on GitHub (Mar 20, 2020). **Describe the bug** Might not be a bug! If it's not, we can make this a feature request? I have the following configured in the .env: SESSION_LIFETIME=120 SESSION_COOKIE_NAME=bookstack_session SESSION_SECURE_COOKIE=true Those settings work great, however, when a user's session expires, nothing happens. As an example, a user is writing a page, locks their computer and leaves for the day, then returns the next day to the same screen. They continue typing, but the moment they hit save or navigate anywhere else, THEN they get returned to the login page. **Steps To Reproduce** Steps to reproduce the behavior: 1. Configure the session settings in .env 2. Login and wait for the session to expire. 3. Notice that nothing has changed. 4. Try to navigate anywhere and then get returned to the login page. **Expected behavior** When a user's session expires, they should be returned to the login page. **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): v0.28.2 - PHP Version: 7.3.14 - Hosting Method (Nginx/Apache/Docker): Linuxserver.io Docker Container (Nginx) If this issue should be taken up with Linuxserver.io, I will post it there instead. Thanks for any assistance you can provide!
Author
Owner

@dopyrory3 commented on GitHub (Mar 24, 2020):

+1 I've deployed Bookstack in my organisation, really would be good to either notify users of session expiration or redirect to the login page.
The current method of handling it by not handling it is frustrating for a lot of people in my experience using this project

@dopyrory3 commented on GitHub (Mar 24, 2020): +1 I've deployed Bookstack in my organisation, really would be good to either notify users of session expiration or redirect to the login page. The current method of handling it by not handling it is frustrating for a lot of people in my experience using this project
Author
Owner

@EHLO1 commented on GitHub (Mar 30, 2020):

I did a bit of reading on Laravel. Doesn't look like it's quite as straight forward as I thought. Apparently there are complications with multiple tabs being open.

An alternative could be to use JS to check last user activity and then post some sort of pop-up message after a period of inactivity letting them know they need to login again, and that they should save (or copy) their data. Is something like this more plausible?

@EHLO1 commented on GitHub (Mar 30, 2020): I did a bit of reading on Laravel. Doesn't look like it's quite as straight forward as I thought. Apparently there are complications with multiple tabs being open. An alternative could be to use JS to check last user activity and then post some sort of pop-up message after a period of inactivity letting them know they need to login again, and that they should save (or copy) their data. Is something like this more plausible?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1604