Ref #3243: remove deprecation warning for UserDetailsService

Also clear the session in case of a login error.