diff --git a/browserid/static/dialog/resources/browserid-network.js b/browserid/static/dialog/resources/browserid-network.js index cc9a9bcf55ad117522fdc2942590b099db53c8b0..714a17fd5c0aebcb8ce464cb73c658f7d5ba2f42 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 a3f938fb3113d5add9f7998b208591d243d2b96d..99c4c79a47bfb67b8908ded515f23eddffe82a54 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(); + + }); + + });