Skip to content

Commit 2536f7e

Browse files
pmusarajZogStriP
authored andcommitted
FIX: Show error message when social auth fails for suspended users (#34173)
Co-authored-by: Régis Hanol <regis@hanol.fr>
1 parent 1381f18 commit 2536f7e

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

app/assets/javascripts/discourse/app/instance-initializers/auth-complete.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ export default {
5353
...properties,
5454
};
5555

56-
router.trigger("showLogin", props);
56+
router.transitionTo("login").then(({ controller }) => {
57+
controller.setProperties(props);
58+
});
5759

5860
next(() => callback?.());
5961
};

spec/system/social_authentication_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,26 @@
437437
signup_page.open.click_social_button("facebook")
438438
expect(page).to have_css(".header-dropdown-toggle.current-user")
439439
end
440+
441+
context "with a suspended user" do
442+
before do
443+
user.suspended_till = 2.years.from_now
444+
user.suspended_at = Time.now
445+
user.save!
446+
end
447+
448+
it "shows suspended message" do
449+
mock_facebook_auth
450+
visit("/")
451+
452+
signup_page.open.click_social_button("facebook")
453+
454+
expect(page).to have_css(
455+
".alert-error",
456+
text: I18n.t("login.suspended", date: I18n.l(user.suspended_till, format: :date_only)),
457+
)
458+
end
459+
end
440460
end
441461

442462
context "with Google" do

0 commit comments

Comments
 (0)