check for null instead of instanceof UserInterface
update test
simplify condition
Merge pull request #3098 from anlutro-pull-requests/userinterface-check

Authentication improvements