refactored user logout when new authentication happens