Fix failed LDAP logins when nil user_id present Closes #56734 See merge request gitlab-org/gitlab-ce!24749