Bug 967197 - "Create Account" and "Sign In" links in Sync preferences should go to separate pages r=markh a=sylvestre
authorTim Taubert <ttaubert@mozilla.com>
Tue, 18 Feb 2014 12:05:13 +0100
changeset 177263 7cfcea73b7e9a6fa113f077144721f2fe981dba9
parent 177262 29d8fd6fe4868fdcb5dcd20e0aeb96b3f7796a12
child 177264 2ce26da7f4adc8125248a1b911abd918ee02eeb8
push id5317
push userttaubert@mozilla.com
push dateFri, 28 Feb 2014 15:04:49 +0000
treeherdermozilla-aurora@2ce26da7f4ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh, sylvestre
bugs967197
milestone29.0a2
Bug 967197 - "Create Account" and "Sign In" links in Sync preferences should go to separate pages r=markh a=sylvestre
browser/app/profile/firefox.js
browser/base/content/aboutaccounts/aboutaccounts.js
browser/components/preferences/sync.js
browser/components/preferences/sync.xul
services/fxaccounts/FxAccounts.jsm
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1346,16 +1346,19 @@ pref("browser.uiCustomization.state", ""
 // The URL where remote content that composes the UI for Firefox Accounts should
 // be fetched. Must use HTTPS.
 pref("identity.fxaccounts.remote.uri", "https://accounts.firefox.com/?service=sync&context=fx_desktop_v1");
 
 // The URL where remote content that forces re-authentication for Firefox Accounts
 // should be fetched.  Must use HTTPS.
 pref("identity.fxaccounts.remote.force_auth.uri", "https://accounts.firefox.com/force_auth?service=sync&context=fx_desktop_v1");
 
+// The remote content URL shown for signin in. Must use HTTPS.
+pref("identity.fxaccounts.remote.signin.uri", "https://accounts.firefox.com/signin?service=sync&context=fx_desktop_v1");
+
 // The URL we take the user to when they opt to "manage" their Firefox Account.
 // Note that this will always need to be in the same TLD as the
 // "identity.fxaccounts.remote.uri" pref.
 pref("identity.fxaccounts.settings.uri", "https://accounts.firefox.com/settings");
 
 // The URL of the Firefox Accounts auth server backend
 pref("identity.fxaccounts.auth.uri", "https://api.accounts.firefox.com/v1");
 
--- a/browser/base/content/aboutaccounts/aboutaccounts.js
+++ b/browser/base/content/aboutaccounts/aboutaccounts.js
@@ -238,16 +238,19 @@ function getStarted() {
 
 function openPrefs() {
   window.openPreferences("paneSync");
 }
 
 function init() {
   if (window.location.href.contains("action=signin")) {
     show("remote");
+    wrapper.init(fxAccounts.getAccountsSignInURI());
+  } else if (window.location.href.contains("action=signup")) {
+    show("remote");
     wrapper.init();
   } else if (window.location.href.contains("action=reauth")) {
     fxAccounts.promiseAccountsForceSigninURI().then(url => {
       show("remote");
       wrapper.init(url);
     });
   } else {
     // Check if we have a local account
--- a/browser/components/preferences/sync.js
+++ b/browser/components/preferences/sync.js
@@ -251,16 +251,20 @@ let gSyncPane = {
       gSyncUtils._openLink(url);
       return;
     }
     win.switchToTabHavingURI(url, true);
     // seeing as we are doing this in a tab we close the prefs dialog.
     window.close();
   },
 
+  signUp: function() {
+    this.openContentInBrowser("about:accounts?action=signup");
+  },
+
   signIn: function() {
     this.openContentInBrowser("about:accounts?action=signin");
   },
 
   reSignIn: function() {
     this.openContentInBrowser("about:accounts?action=reauth");
   },
 
--- a/browser/components/preferences/sync.xul
+++ b/browser/components/preferences/sync.xul
@@ -183,17 +183,17 @@
           <spacer flex="1"/>
           <p>&determiningAcctStatus.label;</p>
           <spacer flex="1"/>
         </vbox>
 
         <vbox id="noFxaAccount">
           <description>&welcome.description;</description>
           <label class="text-link"
-                 onclick="gSyncPane.signIn(); return false;"
+                 onclick="gSyncPane.signUp(); return false;"
                  value="&welcome.createAccount.label;"/>
           <label class="text-link"
                  onclick="gSyncPane.signIn(); return false;"
                  value="&welcome.signIn.label;"/>
           <spacer flex="1"/>
           <label class="text-link"
                  onclick="gSyncPane.openOldSyncSupportPage(); return false;"
                  value="&welcome.useOldSync.label;"/>
--- a/services/fxaccounts/FxAccounts.jsm
+++ b/services/fxaccounts/FxAccounts.jsm
@@ -19,16 +19,17 @@ Cu.import("resource://gre/modules/FxAcco
 Cu.import("resource://gre/modules/FxAccountsCommon.js");
 Cu.import("resource://gre/modules/FxAccountsUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "jwcrypto",
   "resource://gre/modules/identity/jwcrypto.jsm");
 
 // All properties exposed by the public FxAccounts API.
 let publicProperties = [
+  "getAccountsSignInURI",
   "getAccountsURI",
   "getAssertion",
   "getKeys",
   "getSignedInUser",
   "loadAndPoll",
   "localtimeOffsetMsec",
   "now",
   "promiseAccountsForceSigninURI",
@@ -610,16 +611,25 @@ FxAccountsInternal.prototype = {
   getAccountsURI: function() {
     let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.uri");
     if (!/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
       throw new Error("Firefox Accounts server must use HTTPS");
     }
     return url;
   },
 
+  // Return the URI of the remote UI flows.
+  getAccountsSignInURI: function() {
+    let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.signin.uri");
+    if (!/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
+      throw new Error("Firefox Accounts server must use HTTPS");
+    }
+    return url;
+  },
+
   // Returns a promise that resolves with the URL to use to force a re-signin
   // of the current account.
   promiseAccountsForceSigninURI: function() {
     let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.force_auth.uri");
     if (!/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
       throw new Error("Firefox Accounts server must use HTTPS");
     }
     // but we need to append the email address onto a query string.