Maintenance mode: put middleware right after authentication

We want to avoid hitting application code as much as possible, and the
locale middlewares try to access the DB in some situations, so we better
prevent that.