A platform for community discussion. Free, open, simple.
FIX: Show error message when social auth fails for suspended users (#34173)
Penar Musaraj4be8cdeb521e
diff --git a/app/assets/javascripts/discourse/app/instance-initializers/auth-complete.js b/app/assets/javascripts/discourse/app/instance-initializers/auth-complete.jsindex 59cbfc23592..c53f5f0d731 100644--- a/app/assets/javascripts/discourse/app/instance-initializers/auth-complete.js+++ b/app/assets/javascripts/discourse/app/instance-initializers/auth-complete.js@@ -53,7 +53,9 @@ export default {...properties,};- router.trigger("showLogin", props);+ router.transitionTo("login").then(({ controller }) => {+ controller.setProperties(props);+ });next(() => callback?.());};diff --git a/spec/system/social_authentication_spec.rb b/spec/system/social_authentication_spec.rbindex 3f31014fa89..38d5de4e0c1 100644--- a/spec/system/social_authentication_spec.rb+++ b/spec/system/social_authentication_spec.rb@@ -437,6 +437,26 @@ shared_examples "social authentication scenarios" dosignup_page.open.click_social_button("facebook")expect(page).to have_css(".header-dropdown-toggle.current-user")end++ context "with a suspended user" do+ before do+ user.suspended_till = 2.years.from_now+ user.suspended_at = Time.now+ user.save!+ end++ it "shows suspended message" do+ mock_facebook_auth+ visit("/")++ signup_page.open.click_social_button("facebook")++ expect(page).to have_css(+ ".alert-error",+ text: I18n.t("login.suspended", date: I18n.l(user.suspended_till, format: :date_only)),+ )+ end+ endendcontext "with Google" do