Not registered yet?
Register now! It is easy and done in 1 minute and gives you access to special discounts and much more!
When I put site in maintenance mode and after turn site back all users sessions are not active (is need to log in account), but I put session to work 2 month and it work.
How to prevent users logout when put site in maintenance?
This is intended behavior, if user does not have "access site in maintenance mode" permission, then user is logged out.
For Drupal 7 take look on user_menu_site_status_alter
For Drupal 8 take look on Drupal\user\EventSubscriber\MaintenanceModeSubscriber
The question was about losing sessions after the Maintenance mode is turned off, not during it.
Yes, this is the reason why the session is destroyed - the logged-in user visits the website which is in maintenance mode. The user who visits the website after the maintenance mode is turned off will not be logged out.
Thanks for linked to the code here. This is shocking behavior, does anyone know if there were technical reasons behind doing this? Users lose all content they were working on if they hit "submit" or refresh the form they were working on. I am looking for some discussions around this to understand the "why" a bit better.