Skip to content
Snippets Groups Projects
Unverified Commit 4959c1ba authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Added env variable needed when switching social_uids (#3393)

parent 84463974
No related branches found
No related tags found
No related merge requests found
...@@ -85,6 +85,8 @@ module Authenticator ...@@ -85,6 +85,8 @@ module Authenticator
# Check if the user exists under the same email with no social uid and that social accounts are allowed # 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) def auth_changed_to_social?(email)
return true if Rails.configuration.social_switching
Rails.configuration.loadbalanced_configuration && Rails.configuration.loadbalanced_configuration &&
User.exists?(email: email, provider: @user_domain) && User.exists?(email: email, provider: @user_domain) &&
!allow_greenlight_accounts? !allow_greenlight_accounts?
......
...@@ -266,7 +266,10 @@ flash: { alert: I18n.t("registration.insecure_password") } unless User.secure_pa ...@@ -266,7 +266,10 @@ flash: { alert: I18n.t("registration.insecure_password") } unless User.secure_pa
# Set the user's social id to the new id being passed # Set the user's social id to the new id being passed
def switch_account_to_social def switch_account_to_social
user = User.find_by(email: @auth['info']['email'], provider: @user_domain) user = User.find_by({
email: @auth['info']['email'],
provider: Rails.configuration.loadbalanced_configuration ? @user_domain : nil
}.compact)
logger.info "Switching social account for #{user.uid}" logger.info "Switching social account for #{user.uid}"
......
...@@ -186,5 +186,7 @@ module Greenlight ...@@ -186,5 +186,7 @@ module Greenlight
# Max avatar image size # Max avatar image size
config.max_avatar_size = ENV['MAX_AVATAR_SIZE'].to_i.zero? ? 100_000 : ENV['MAX_AVATAR_SIZE'].to_i config.max_avatar_size = ENV['MAX_AVATAR_SIZE'].to_i.zero? ? 100_000 : ENV['MAX_AVATAR_SIZE'].to_i
config.social_switching = ENV['SOCIAL_SWITCHING'] == "true"
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment