FIX: Never display the invite show page form if DiscourseConnect enabled (#12466)

This form does not need to show if discourse connect is enabled
because generally the fields that would be filled in here are
filled in by the SSO provider. There is also an issue right now
where enable_local_logins and enable_discourse_connect can be
true at the same time which is not right.
This commit is contained in:
Martin Brennan 2021-03-23 09:02:07 +10:00 committed by GitHub
parent e45bca7298
commit bcd6efa98c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -107,8 +107,9 @@ export default Controller.extend(
)
shouldDisplayForm(externalAuthsOnly, authOptions, emailValidationFailed) {
return (
this.siteSettings.enable_local_logins ||
(externalAuthsOnly && authOptions && !emailValidationFailed)
(this.siteSettings.enable_local_logins ||
(externalAuthsOnly && authOptions && !emailValidationFailed)) &&
!this.siteSettings.enable_discourse_connect
);
},

View File

@ -217,6 +217,23 @@ acceptance(
}
);
acceptance(
"Invite accept when DiscourseConnect SSO is enabled and local login is enabled (bad config)",
function (needs) {
needs.settings({
enable_local_logins: true,
enable_discourse_connect: true,
});
test("invite link", async function (assert) {
preloadInvite({ link: true });
await visit("/invites/myvalidinvitetoken");
assert.ok(!exists("form"), "does not display the form");
});
}
);
acceptance("Invite link with authentication data", function (needs) {
needs.settings({ enable_local_logins: false });