Moved user-checking conditional out of the ensureAuthenticated middleware.