Social uid rake task (#2906)

This commit is contained in:
Ahmad Farhat 2021-09-19 13:45:11 -04:00 committed by GitHub
parent beb414aec7
commit e0972efc40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -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