One outer if for the login check