Bug 518069: forgot password UI / bug 518067: directional sync dialog during setup
authorDan Mills <thunder@mozilla.com>
Mon, 21 Sep 2009 23:52:00 -0700
changeset 45768 f7494a72e424ddf75bd3fe48e9811b79bf4e6680
parent 45767 51db8a5496ff7b3d1f1b71b89900fc2150d32b2e
child 45769 23355b9604c6a942e029c667a7c9b1ccfbb00fbb
push id14033
push useredward.lee@engineering.uiuc.edu
push dateWed, 23 Jun 2010 22:21:35 +0000
treeherdermozilla-central@227db4ad8cdf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs518069, 518067
Bug 518069: forgot password UI / bug 518067: directional sync dialog during setup
services/sync/modules/service.js
services/sync/services-sync.js
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -626,16 +626,26 @@ WeaveSvc.prototype = {
       this.passphrase = newphrase;
 
       /* Login in sync: this also generates new keys */
       this.login(username, password, newphrase);
       this.sync(true);
       return true;
     }))(),
 
+  requestPasswordReset: function WeaveSvc_requestPasswordReset(username) {
+    let res = new Resource(Utils.getURLPref("pwChangeURL"));
+    res.authenticator = new NoOpAuthenticator();
+    res.headers['Content-Type'] = 'application/x-www-form-urlencoded';
+    let ret = res.post('uid=' + username);
+    if (ret.indexOf("Further instructions have been sent") >= 0)
+      return true;
+    return false;
+  },
+
   _autoConnectAttempts: 0,
   _autoConnect: function WeaveSvc__attemptAutoConnect() {
     try {
       if (!this.username || !this.password || !this.passphrase)
         return;
 
       let failureReason;
       if (Svc.IO.offline)
--- a/services/sync/services-sync.js
+++ b/services/sync/services-sync.js
@@ -1,11 +1,12 @@
 pref("extensions.weave.serverURL", "@server_url@");
 pref("extensions.weave.userURL", "user/");
 pref("extensions.weave.miscURL", "misc/");
+pref("extensions.weave.pwChangeURL", "https://services.mozilla.com/pw/forgot.php");
 pref("extensions.weave.termsURL", "https://labs.mozilla.com/projects/weave/tos/");
 
 pref("extensions.weave.encryption", "aes-256-cbc");
 
 pref("extensions.weave.lastversion", "firstrun");
 
 pref("extensions.weave.ui.syncnow", true);
 pref("extensions.weave.ui.sharebookmarks", false);