Refactor view code to display on if logged in