Bug 1855513: Move in-browser verification to open web content. r=markh,fluent-reviewers,settings-reviewers,Gijs,bolsson

Differential Revision: https://phabricator.services.mozilla.com/D193678
This commit is contained in:
Tarik Eshaq 2023-11-22 17:58:18 +00:00
parent e5732140e2
commit 4574d82b32
4 changed files with 20 additions and 35 deletions

View file

@ -1170,9 +1170,11 @@ var gSync = {
this.openFxAEmailFirstPageFromFxaMenu(panel);
break;
case UIState.STATUS_LOGIN_FAILED:
case UIState.STATUS_NOT_VERIFIED:
this.openPrefsFromFxaMenu("sync_settings", panel);
break;
case UIState.STATUS_NOT_VERIFIED:
this.openFxAEmailFirstPage("fxa_app_menu_reverify");
break;
case UIState.STATUS_SIGNED_IN:
this.openFxAManagePageFromFxaMenu(panel);
}

View file

@ -101,7 +101,7 @@
<hbox class="fxaAccountBoxButtons">
<button id="verifyFxaAccount"
is="highlightable-button"
data-l10n-id="sync-resend-verification"/>
data-l10n-id="sync-verify-account"/>
<button id="unverifiedUnlinkFxaAccount"
is="highlightable-button"
data-l10n-id="sync-remove-account"/>

View file

@ -218,7 +218,9 @@ var gSyncPane = {
/* no warning as account can't have previously synced */
gSyncPane.unlinkFirefoxAccount(false);
});
setEventListener("rejectReSignIn", "command", gSyncPane.reSignIn);
setEventListener("rejectReSignIn", "command", function () {
gSyncPane.reSignIn(this._getEntryPoint());
});
setEventListener("rejectUnlinkFxaAccount", "command", function () {
gSyncPane.unlinkFirefoxAccount(true);
});
@ -440,7 +442,13 @@ var gSyncPane = {
this.replaceTabWithUrl(url);
},
async reSignIn() {
/**
* Attempts to take the user through the sign in flow by opening the web content
* with the given entrypoint as a query parameter
* @param entrypoint: An string appended to the query parameters, used in telemtry to differentiate
* different entrypoints to accounts
* */
async reSignIn(entrypoint) {
// There's a bit of an edge-case here - we might be forcing reauth when we've
// lost the FxA account data - in which case we'll not get a URL as the re-auth
// URL embeds account info and the server endpoint complains if we don't
@ -449,10 +457,9 @@ var gSyncPane = {
return;
}
let entryPoint = this._getEntryPoint();
const url =
(await FxAccounts.config.promiseForceSigninURI(entryPoint)) ||
(await FxAccounts.config.promiseConnectAccountURI(entryPoint));
(await FxAccounts.config.promiseForceSigninURI(entrypoint)) ||
(await FxAccounts.config.promiseConnectAccountURI(entrypoint));
this.replaceTabWithUrl(url);
},
@ -484,21 +491,7 @@ var gSyncPane = {
},
async verifyFirefoxAccount() {
let titleL10nid, bodyL10nId;
try {
await fxAccounts.resendVerificationEmail();
const { email } = await fxAccounts.getSignedInUser();
titleL10nid = "sync-verification-sent-title";
bodyL10nId = { id: "sync-verification-sent-body", args: { email } };
} catch {
titleL10nid = "sync-verification-not-sent-title";
bodyL10nId = "sync-verification-not-sent-body";
}
const [title, body] = await document.l10n.formatValues([
titleL10nid,
bodyL10nId,
]);
new Notification(title, { body });
return this.reSignIn("preferences-reverify");
},
// Disconnect the account, including everything linked.

View file

@ -881,9 +881,9 @@ sync-signedin-login-failure = Please sign in to reconnect { $email }
##
sync-resend-verification =
.label = Resend Verification
.accesskey = d
sync-verify-account =
.label = Verify Account
.accesskey = V
sync-remove-account =
.label = Remove Account
@ -997,16 +997,6 @@ sync-device-name-save =
sync-connect-another-device = Connect another device
## These strings are shown in a desktop notification after the
## user requests we resend a verification email.
sync-verification-sent-title = Verification Sent
# Variables:
# $email (String): Email address of user's Firefox account.
sync-verification-sent-body = A verification link has been sent to { $email }.
sync-verification-not-sent-title = Unable to Send Verification
sync-verification-not-sent-body = We are unable to send a verification mail at this time, please try again later.
## Privacy Section
privacy-header = Browser Privacy