Check login before initializing UI and show main view after logging in