Spain and Portugal travel: What are my rights if my flight was cancelled due to the blackout?

Thousands of travellers were left stranded, with some spending the night on airport floors.