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

#4354