forked from discourse/discourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: display warning when SSO email is different from invite email (d…
…iscourse#13804) In this commit, we skipped frontend validation when email is obfuscated: discourse@534008ba24c However, if email from SSO is different from email from invite, we should still display warning.
- Loading branch information
Showing
3 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { | ||
acceptance, | ||
exists, | ||
query, | ||
queryAll, | ||
} from "discourse/tests/helpers/qunit-helpers"; | ||
import { fillIn, visit } from "@ember/test-helpers"; | ||
|
@@ -22,7 +23,12 @@ function setAuthenticationData(hooks, json) { | |
}); | ||
} | ||
|
||
function preloadInvite({ link = false, email_verified_by_link = false } = {}) { | ||
function preloadInvite({ | ||
link = false, | ||
email_verified_by_link = false, | ||
different_external_email = false, | ||
hidden_email = false, | ||
} = {}) { | ||
const info = { | ||
invited_by: { | ||
id: 123, | ||
|
@@ -33,6 +39,8 @@ function preloadInvite({ link = false, email_verified_by_link = false } = {}) { | |
}, | ||
username: "invited", | ||
email_verified_by_link: email_verified_by_link, | ||
different_external_email: different_external_email, | ||
hidden_email: hidden_email, | ||
}; | ||
|
||
if (link) { | ||
|
@@ -362,6 +370,32 @@ acceptance( | |
} | ||
); | ||
|
||
acceptance( | ||
"Email Invite link with different external email address", | ||
function (needs) { | ||
needs.settings({ enable_local_logins: false }); | ||
|
||
setAuthenticationData(needs.hooks, { | ||
auth_provider: "facebook", | ||
email: "[email protected]", | ||
email_valid: true, | ||
username: "foobar", | ||
name: "barfoo", | ||
}); | ||
|
||
test("display information that email is invalid", async function (assert) { | ||
preloadInvite({ different_external_email: true, hidden_email: true }); | ||
|
||
await visit("/invites/myvalidinvitetoken"); | ||
|
||
assert.equal( | ||
query(".bad").textContent.trim(), | ||
"Your invitation email does not match the email authenticated by Facebook" | ||
); | ||
}); | ||
} | ||
); | ||
|
||
acceptance( | ||
"Email Invite link with valid authentication data, valid email token, unverified authentication email", | ||
function (needs) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters