Fix bug: autologin did not work when login was required for viewing