A simple middleware function that checks if a user is logged in and shows a 401 page if they're not.