From a03a79a1588897d15b5b57443a522c8e72354333 Mon Sep 17 00:00:00 2001
From: Shane Tomlinson <stomlinson@mozilla.com>
Date: Wed, 28 Sep 2011 12:59:53 +0100
Subject: [PATCH] Hooking up the reset password flow to the network layer. 
 requestResetPassword hooked up to createUser for now.

This means we can now reset a password, though it removes all linked email addresses.
---
 .../dialog/controllers/authenticate_controller.js     | 11 +++++++++--
 .../static/dialog/resources/browserid-network.js      |  4 +---
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/browserid/static/dialog/controllers/authenticate_controller.js b/browserid/static/dialog/controllers/authenticate_controller.js
index 9b45226a8..b5d297d07 100644
--- a/browserid/static/dialog/controllers/authenticate_controller.js
+++ b/browserid/static/dialog/controllers/authenticate_controller.js
@@ -169,8 +169,15 @@
 
     resetPassword: function() {
       var email = $("#email").val();
-      this.close("reset_password", {
-        email: email
+      var me=this;
+      network.requestPasswordReset(email, function(reset) {
+        if (reset) {
+          me.close("reset_password", {
+            email: email
+          });
+        }
+      }, function onFailure() {
+
       });
     }
   });
diff --git a/browserid/static/dialog/resources/browserid-network.js b/browserid/static/dialog/resources/browserid-network.js
index 714a17fd5..9cdaf01aa 100644
--- a/browserid/static/dialog/resources/browserid-network.js
+++ b/browserid/static/dialog/resources/browserid-network.js
@@ -242,9 +242,7 @@ var BrowserIDNetwork = (function() {
     requestPasswordReset: function(email, onSuccess, onFailure) {
       // XXX fill this in.
       if (email) {
-        if (onSuccess) {
-          _.defer(onSuccess);
-        }
+        this.createUser(email, onSuccess, onFailure);
       }
 
     },
-- 
GitLab