From f37ac50f2e6af0fbe60dd2103095a6411b1dc07b Mon Sep 17 00:00:00 2001 From: Shane Tomlinson <stomlinson@mozilla.com> Date: Wed, 28 Sep 2011 12:03:55 +0100 Subject: [PATCH] Adding a requestPasswordReset shell and test shell. --- .../dialog/resources/browserid-network.js | 21 ++++++++++++-- .../test/qunit/browserid-network_test.js | 29 +++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/browserid/static/dialog/resources/browserid-network.js b/browserid/static/dialog/resources/browserid-network.js index cc9a9bcf5..714a17fd5 100644 --- a/browserid/static/dialog/resources/browserid-network.js +++ b/browserid/static/dialog/resources/browserid-network.js @@ -233,9 +233,26 @@ var BrowserIDNetwork = (function() { }, /** - * Set the password of the current user. + * Request a password reset for the given email address. + * @method requestPasswordReset + * @param {string} email - email address to reset password for. + * @param {function} [onSuccess] - Callback to call when complete. + * @param {function} [onFailure] - Called on XHR failure. + */ + requestPasswordReset: function(email, onSuccess, onFailure) { + // XXX fill this in. + if (email) { + if (onSuccess) { + _.defer(onSuccess); + } + } + + }, + + /** + * Update the password of the current user. * @method setPassword - * @param {string} password - password to set + * @param {string} password - new password. * @param {function} [onSuccess] - Callback to call when complete. * @param {function} [onFailure] - Called on XHR failure. */ diff --git a/browserid/static/dialog/test/qunit/browserid-network_test.js b/browserid/static/dialog/test/qunit/browserid-network_test.js index a3f938fb3..99c4c79a4 100644 --- a/browserid/static/dialog/test/qunit/browserid-network_test.js +++ b/browserid/static/dialog/test/qunit/browserid-network_test.js @@ -433,4 +433,33 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/browserid-netw ok(true, "syncEmails"); }); + test("setPassword", function() { + network.setPassword("assword", function onSuccess() { + // XXX need a test here; + ok(true); + start(); + }, function onFailure() { + ok(false); + start(); + }); + + stop(); + }); + + + test("requestPasswordReset", function() { + network.requestPasswordReset("address", function onSuccess() { + // XXX need a test here; + ok(true); + start(); + }, function onFailure() { + ok(false); + start(); + }); + + stop(); + + }); + + }); -- GitLab