Add middleware for checking if user is logged in