diff --git a/lib/tasks/2018_08_24_encrypt_tokens.rake b/lib/tasks/2018_08_24_encrypt_tokens.rake new file mode 100644 index 000000000..d28c023d5 --- /dev/null +++ b/lib/tasks/2018_08_24_encrypt_tokens.rake @@ -0,0 +1,10 @@ +namespace :'2018_08_24_encrypt_tokens' do + task run: :environment do + Administrateur + .where + .not(api_token: nil) + .each do |admin| + admin.update(encrypted_token: BCrypt::Password.create(admin.api_token)) + end + end +end