From e0972efc408d13fcfb07efecc92463b10d796e0b Mon Sep 17 00:00:00 2001 From: Ahmad Farhat Date: Sun, 19 Sep 2021 13:45:11 -0400 Subject: [PATCH] Social uid rake task (#2906) --- lib/tasks/user.rake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/tasks/user.rake b/lib/tasks/user.rake index b26e0427..1220f51c 100644 --- a/lib/tasks/user.rake +++ b/lib/tasks/user.rake @@ -57,4 +57,14 @@ namespace :user do puts "PLEASE CHANGE YOUR PASSWORD IMMEDIATELY" if u[:password] == Rails.configuration.admin_password_default end end + + task :social_uid, [:provider] => :environment do |_task, args| + args.with_defaults(provider: "greenlight") + + User.where(provider: args[:provider]).each do |user| + if user.update(social_uid: "#{args[:provider]}:#{user.email}") + puts "Updated #{user.email} to #{args[:provider]}:#{user.email}" + end + end + end end