changed the switch view, adding the redirection if user is authenticated