Skip to content
Snippets Groups Projects
Commit 4e159f54 authored by Shane Tomlinson's avatar Shane Tomlinson
Browse files

Adding more test and doc stubs.

parent 5eea3ce0
No related branches found
No related tags found
No related merge requests found
......@@ -192,6 +192,15 @@ var BrowserIDNetwork = (function() {
});
},
/**
* Check whether the email is already registered.
* @method haveEmail
* @param {string} email - Email address to check.
* @param {function} [onSuccess] - Called with one boolean parameter when
* complete. Parameter is true if `email` is already registered, false
* otw.
* @param {function} [onFailure] - Called on XHR failure.
*/
haveEmail: function(email, onSuccess, onFailure) {
$.ajax({
url: '/wsapi/have_email?email=' + encodeURIComponent(email),
......@@ -205,24 +214,39 @@ var BrowserIDNetwork = (function() {
});
},
/**
* Remove an email address from the current user.
* @method removeEmail
* @param {string} email - Email address to remove.
* @param {function} [onSuccess] - Called whenever complete.
* @param {function} [onFailure] - Called on XHR failure.
*/
removeEmail: function(email, onSuccess, onFailure) {
$.ajax({
type: 'POST',
url: '/wsapi/remove_email',
data: {
email: email,
csrf: BrowserIDNetwork.csrf_token
},
success: function() {
removeEmail(email);
if(onSuccess) {
onSuccess();
}
},
failure: onFailure
withCSRF(function() {
$.ajax({
type: 'POST',
url: '/wsapi/remove_email',
data: {
email: email,
csrf: csrf_token
},
success: function() {
removeEmail(email);
if(onSuccess) {
onSuccess();
}
},
failure: onFailure
});
});
},
/**
* Check the current user's registration status
* @method checkRegistration
* @param {function} [onSuccess] - Called when complete.
* @param {function} [onFailure] - Called on XHR failure.
*/
checkRegistration: function(onSuccess, onFailure) {
$.ajax({
url: '/wsapi/registration_status',
......@@ -235,6 +259,10 @@ var BrowserIDNetwork = (function() {
});
},
/**
* Set the public key for the email address.
* @method setKey
*/
setKey: function(email, keypair, onSuccess, onError) {
withCSRF(function() {
$.ajax({
......@@ -251,6 +279,10 @@ var BrowserIDNetwork = (function() {
});
},
/**
* Sync emails
* @method syncEmails
*/
syncEmails: function(issued_identities, onKeySyncSuccess, onKeySyncFailure, onSuccess, onFailure) {
withCSRF(function() {
$.ajax({
......
......@@ -70,6 +70,26 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/browserid-netw
});
test("stageUser", function() {
ok(true, "yar");
ok(true, "stageUser");
});
test("haveEmail", function() {
ok(true, "haveEmail");
});
test("removeEmail", function() {
ok(true, "removeEmail");
});
test("checkRegistration", function() {
ok(true, "checkRegistration");
});
test("setKey", function() {
ok(true, "setKey");
});
test("syncEmails", function() {
ok(true, "syncEmails");
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment