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

Authentication improvements
Fix if check.