Modernize the CSRF migration helper.

Thanks Lennart Regebro for spotting that code.