discourse/spec/support
Martin Brennan 355d51afde
FEATURE: Allow using invites when DiscourseConnect SSO is enabled (#12419)
This PR allows invitations to be used when the DiscourseConnect SSO is enabled for a site (`enable_discourse_connect`) and local logins are disabled. Previously invites could not be accepted with SSO enabled simply because we did not have the code paths to handle that logic.

The invitation methods that are supported include:

* Inviting people to groups via email address
* Inviting people to topics via email address
* Using invitation links generated by the Invite Users UI in the /my/invited/pending route

The flow works like this:

1. User visits an invite URL
2. The normal invitation validations (redemptions/expiry) happen at that point
3. We store the invite key in a secure session
4. The user clicks "Accept Invitation and Continue" (see below)
5. The user is redirected to /session/sso then to the SSO provider URL then back to /session/sso_login
6. We retrieve the invite based on the invite key in secure session. We revalidate the invitation. We show an error to the user if it is not valid. An additional check here for invites with an email specified is to check the SSO email matches the invite email
7. If the invite is OK we create the user via the normal SSO methods
8. We redeem the invite and activate the user. We clear the invite key in secure session.
9. If the invite had a topic we redirect the user there, otherwise we redirect to /

Note that we decided for SSO-based invites the `must_approve_users` site setting is ignored, because the invite is a form of pre-approval, and because regular non-staff users cannot send out email invites or generally invite to the forum in this case.

Also deletes some group invite checks as per https://github.com/discourse/discourse/pull/12353
2021-03-19 10:20:10 +10:00
..
versioning DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
concurrency.rb Revert "FIX: Redis fallback handler refactoring (#8771)" (#8776) 2020-01-24 09:20:17 +11:00
diagnostics_helper.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
discourse_event_helper.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
fake_logger.rb DEV: Fix `FakeLogger` spec issues (#12397) 2021-03-15 15:36:10 +11:00
helpers.rb Tag groups can belong to groups (#10854) 2020-10-14 13:15:54 -04:00
integration_helpers.rb FEATURE: Allow using invites when DiscourseConnect SSO is enabled (#12419) 2021-03-19 10:20:10 +10:00
match_html_matcher.rb FIX: Make Oneboxer#apply insert block Oneboxes correctly (#11449) 2020-12-14 17:49:37 +02:00
rate_limit_matcher.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
shared_examples_for_stats_cacheable.rb DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
sidekiq_helpers.rb DEV: Change Topic Timer from enqueue_at scheduled jobs to incrementally executed jobs (#11698) 2021-01-19 13:30:58 +10:00
site_settings_helpers.rb DEV: use #frozen_string_literal: true on all spec 2019-04-30 10:27:42 +10:00
time_matcher.rb DEV: adds within_one_minute time matcher (#12109) 2021-02-17 10:52:49 +01:00
uploads_helpers.rb FIX: Do not enable published page if secure media enabled (#11131) 2020-11-06 10:33:19 +10:00
webauthn_integration_helpers.rb DEV: stop freezing frozen strings 2020-04-30 16:48:53 +10:00