Modified for invited user with autoenroll off.
Tidyup for PR.