From 06deffc9da5195049109d4e6fdc8842d0304d2b9 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Fri, 13 Jul 2018 22:49:30 +0530 Subject: [PATCH] FIX: returns provider_not_enabled error even if enabled --- app/controllers/users/omniauth_callbacks_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index f168403caaf..dc7cbfdb60a 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -99,10 +99,12 @@ class Users::OmniauthCallbacksController < ApplicationController end Discourse.auth_providers.each do |provider| + next if provider.name != name + unless provider.enabled_setting.nil? || SiteSetting.send(provider.enabled_setting) raise Discourse::InvalidAccess.new(I18n.t("provider_not_enabled")) end - return provider.authenticator if provider.name == name + return provider.authenticator end raise Discourse::InvalidAccess.new(I18n.t("provider_not_found"))