mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1070115 - pass the uid and email address of the current FxA user to the account manage url. r=zaach
This commit is contained in:
parent
1875df6a47
commit
8a61e04761
@ -573,8 +573,12 @@ let gSyncPane = {
|
||||
},
|
||||
|
||||
manageFirefoxAccount: function() {
|
||||
let url = Services.prefs.getCharPref("identity.fxaccounts.settings.uri");
|
||||
this.openContentInBrowser(url);
|
||||
fxAccounts.promiseAccountsManageURI()
|
||||
.then(url => {
|
||||
this.openContentInBrowser(url, {
|
||||
replaceQueryString: true
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
verifyFirefoxAccount: function() {
|
||||
|
@ -405,8 +405,12 @@ let gSyncPane = {
|
||||
},
|
||||
|
||||
manageFirefoxAccount: function() {
|
||||
let url = Services.prefs.getCharPref("identity.fxaccounts.settings.uri");
|
||||
this.openContentInBrowser(url);
|
||||
fxAccounts.promiseAccountsManageURI()
|
||||
.then(url => {
|
||||
this.openContentInBrowser(url, {
|
||||
replaceQueryString: true
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
verifyFirefoxAccount: function() {
|
||||
|
@ -45,6 +45,7 @@ let publicProperties = [
|
||||
"now",
|
||||
"promiseAccountsForceSigninURI",
|
||||
"promiseAccountsChangeProfileURI",
|
||||
"promiseAccountsManageURI",
|
||||
"removeCachedOAuthToken",
|
||||
"resendVerificationEmail",
|
||||
"setSignedInUser",
|
||||
@ -1217,6 +1218,28 @@ FxAccountsInternal.prototype = {
|
||||
}).then(result => currentState.resolve(result));
|
||||
},
|
||||
|
||||
// Returns a promise that resolves with the URL to use to manage the current
|
||||
// user's FxA acct.
|
||||
promiseAccountsManageURI: function() {
|
||||
let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.settings.uri");
|
||||
if (this._requireHttps() && !/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
|
||||
throw new Error("Firefox Accounts server must use HTTPS");
|
||||
}
|
||||
let currentState = this.currentAccountState;
|
||||
// but we need to append the uid and email address onto a query string
|
||||
// (if the server has no matching uid it will offer to sign in with the
|
||||
// email address)
|
||||
return this.getSignedInUser().then(accountData => {
|
||||
if (!accountData) {
|
||||
return null;
|
||||
}
|
||||
let newQueryPortion = url.indexOf("?") == -1 ? "?" : "&";
|
||||
newQueryPortion += "uid=" + encodeURIComponent(accountData.uid) +
|
||||
"&email=" + encodeURIComponent(accountData.email);
|
||||
return url + newQueryPortion;
|
||||
}).then(result => currentState.resolve(result));
|
||||
},
|
||||
|
||||
/**
|
||||
* Get an OAuth token for the user
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user