Nigeria imposes curfew on towns attacked by militants