Fix logging out of users.
Merge pull request #4668 from openscholar/4354-2

Fix logging out of users in "read-only" mode