GRN2-252: Change to how sign ins are processed (#869)

* Social to local

* Social/Local to Social

* Rubocop fixes

* Added test cases

* Added the ability to clear social uids

* Update admins_controller.rb

* Update admins_controller.rb
This commit is contained in:
Ahmad Farhat
2020-01-22 16:32:56 -05:00
committed by farhatahmad
parent 42e6e4f235
commit 005ec84c73
10 changed files with 181 additions and 3 deletions

View File

@ -68,6 +68,18 @@ module Authenticator
session.delete(:user_id) if current_user
end
# Check if the user is using local accounts
def auth_changed_to_local?(user)
Rails.configuration.loadbalanced_configuration && user.social_uid.present? && allow_greenlight_accounts?
end
# Check if the user exists under the same email with no social uid and that social accounts are allowed
def auth_changed_to_social?(email)
Rails.configuration.loadbalanced_configuration &&
User.exists?(email: email, provider: @user_domain, social_uid: nil) &&
!allow_greenlight_accounts?
end
private
# Migrates all of the twitter users rooms to the new account