Skip to content

Conversation

ZogStriP
Copy link
Member

DiscourseConnect "required" auth_immediately to also be enabled to work properly but this was incorrect.

This fixes that assumption and add specs to cover all combination of

  • login_required
  • auth_immediately
  • visiting /
  • visiting /login

Internal ref - t/161485

@ZogStriP ZogStriP requested a review from pmusaraj August 19, 2025 20:40
@ZogStriP ZogStriP force-pushed the fix-discourse-connect-with-auth-immediately branch from b67f9e0 to 0bed875 Compare August 20, 2025 08:12
@ZogStriP
Copy link
Member Author

@pmusaraj I've simplified the logic and made the DiscourseConnect and SingleExternalAuth code paths the same. So now, whenever you go to /login (no matter how to), you'll be automatically redirected to SSO 👍

DiscourseConnect "required" auth_immediately to also be enabled to work properly but this was incorrect.

This fixes that assumption and add specs to cover all combinations of

- login_required
- auth_immediately
- visiting /
- visiting / and clicking the login button
- visiting /login directly

Internal ref - t/161485
instead of when some combination of site settings is present.
@ZogStriP ZogStriP force-pushed the fix-discourse-connect-with-auth-immediately branch from 0bed875 to 8899044 Compare August 20, 2025 09:21
Copy link
Contributor

@pmusaraj pmusaraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just the one question about dropping the signup: true parameter.

@@ -35,6 +35,7 @@ export default class extends DiscourseRoute {
const { referrer } = document;
const { canSignUp } = this.controllerFor("application");
const { isOnlyOneExternalLoginMethod, singleExternalLogin } = this.login;
const redirect = auth_immediately || login_required || !from || wantsTo;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a follow-up, it's a little unclear what the !from and wantTo properties here represent.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from comes from the transition object which lets us differentiate between in-app navigation vs full-page navigation.

wantsTo is when you click a button in the app, for which the event bubbles up to the application route and calls either the showLogin or showCreateAccount action.

More than happy to rename them if you have ideas!

@ZogStriP ZogStriP merged commit 1fbb439 into main Aug 20, 2025
15 of 16 checks passed
@ZogStriP ZogStriP deleted the fix-discourse-connect-with-auth-immediately branch August 20, 2025 12:36
ZogStriP added a commit that referenced this pull request Aug 20, 2025
DiscourseConnect "required" auth_immediately to also be enabled to work properly but this was incorrect.

This fixes that assumption and add specs to cover all combinations of

- login_required
- auth_immediately
- visiting /
- visiting / and clicking the login button
- visiting /login directly

Internal ref - t/161485
yuriyaran pushed a commit that referenced this pull request Aug 21, 2025
DiscourseConnect "required" auth_immediately to also be enabled to work properly but this was incorrect.

This fixes that assumption and add specs to cover all combinations of

- login_required
- auth_immediately
- visiting /
- visiting / and clicking the login button
- visiting /login directly

Internal ref - t/161485
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants