mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Allow linking an existing account from invite acceptance (#13998)
The invite acceptance page is an alternative signup flow, so it makes sense to include the new 'link' functionality there as well.
Followup to 7dc8f8b794
This commit is contained in:
parent
e9b2415e7d
commit
70f8fdbe45
@ -212,6 +212,17 @@ export default Controller.extend(
|
|||||||
@discourseComputed
|
@discourseComputed
|
||||||
ssoPath: () => getUrl("/session/sso"),
|
ssoPath: () => getUrl("/session/sso"),
|
||||||
|
|
||||||
|
@discourseComputed("authOptions.associate_url", "authOptions.auth_provider")
|
||||||
|
associateHtml(url, provider) {
|
||||||
|
if (!url) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return I18n.t("create_account.associate", {
|
||||||
|
associate_link: url,
|
||||||
|
provider: I18n.t(`login.${provider}.name`),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
submit() {
|
submit() {
|
||||||
const userFields = this.userFields;
|
const userFields = this.userFields;
|
||||||
|
@ -20,6 +20,12 @@
|
|||||||
<p>{{i18n "invites.invited_by"}}</p>
|
<p>{{i18n "invites.invited_by"}}</p>
|
||||||
<p>{{user-info user=invitedBy}}</p>
|
<p>{{user-info user=invitedBy}}</p>
|
||||||
|
|
||||||
|
{{#if associateHtml}}
|
||||||
|
<p class="create-account-associate-link">
|
||||||
|
{{html-safe associateHtml}}
|
||||||
|
</p>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#unless isInviteLink}}
|
{{#unless isInviteLink}}
|
||||||
<p class="email-message">
|
<p class="email-message">
|
||||||
{{html-safe yourEmailMessage}}
|
{{html-safe yourEmailMessage}}
|
||||||
|
@ -451,3 +451,30 @@ acceptance(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
acceptance(
|
||||||
|
"Invite link with authentication data, and associate link",
|
||||||
|
function (needs) {
|
||||||
|
needs.settings({ enable_local_logins: false });
|
||||||
|
|
||||||
|
setAuthenticationData(needs.hooks, {
|
||||||
|
auth_provider: "facebook",
|
||||||
|
email: "blah@example.com",
|
||||||
|
email_valid: true,
|
||||||
|
username: "foobar",
|
||||||
|
name: "barfoo",
|
||||||
|
associate_url: "/associate/abcde",
|
||||||
|
});
|
||||||
|
|
||||||
|
test("shows the associate link", async function (assert) {
|
||||||
|
preloadInvite({ link: true });
|
||||||
|
|
||||||
|
await visit("/invites/myvalidinvitetoken");
|
||||||
|
|
||||||
|
assert.ok(
|
||||||
|
exists(".create-account-associate-link"),
|
||||||
|
"shows the associate account link"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user