Logging out when already logged out crashes
When clicking on log out after already being logged out (e.g. via another tab) you are redirect to a blank page and an error is logged to sentry.
Steps to reproduce
- Open foodsharing and login
- Open foodsharing in another window
- Log out in the second window
- Go back to the first window (without reloading it) and log out there too
- The site crashes in the background show a blank page to the user
What is the current bug behavior?
See steps above
What is the expected correct behavior?
It should not crash and redirect the user to the start page.
Relevant error messages and/or screenshots
Related sentry issue: https://sentry.io/share/issue/eec3d7bd67f7486aa1c6dfb0791f3533/
In the logout function the user is set to false (https://gitlab.com/foodsharing-dev/foodsharing/blob/master/src/Lib/Session.php#L141) but the set function throws an error if the session is not initialized (https://gitlab.com/foodsharing-dev/foodsharing/blob/master/src/Lib/Session.php#L229).
A possible solution may be either to first check whether the user is already set to false or to catch the exception.