MDL-48479 core_lib: reshuffled the logic in require_login() to allow autologinguests to work