summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-09-07 10:19:49 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2016-09-07 10:19:49 -0400
commit268a4e0b252b0d3f59645e937293ac4cb65cce83 (patch)
tree4585df3c25e2623914d7a243ea7e7c07345a82fd
parent7a6e187e0a970ad6fb722fc9dfd3be784b254c06 (diff)
[refactor] update www/app/lib/bitmask.js
- fix a typo - Mantaining two copies looks like a very bad idea. I'll probably make this a symlink.
-rw-r--r--src/leap/bitmask/core/web/bitmask.js7
-rw-r--r--www/app/lib/bitmask.js52
2 files changed, 47 insertions, 12 deletions
diff --git a/src/leap/bitmask/core/web/bitmask.js b/src/leap/bitmask/core/web/bitmask.js
index 9ac11b7b..ae209512 100644
--- a/src/leap/bitmask/core/web/bitmask.js
+++ b/src/leap/bitmask/core/web/bitmask.js
@@ -27,6 +27,9 @@
* finished or will fail if there was any error. Errors are always user readable
* strings.
*/
+
+import "babel-polyfill";
+
var bitmask = function(){
var event_handlers = {};
@@ -140,7 +143,7 @@ var bitmask = function(){
if (typeof autoconf !== 'boolean') {
autoconf = false;
}
- return call(['bonafide', 'user', 'create', uid, password, autocnof]);
+ return call(['bonafide', 'user', 'create', uid, password, autoconf]);
},
/**
@@ -293,3 +296,5 @@ var bitmask = function(){
}
};
}();
+
+module.exports = bitmask
diff --git a/www/app/lib/bitmask.js b/www/app/lib/bitmask.js
index ecddd16f..5ca280cb 100644
--- a/www/app/lib/bitmask.js
+++ b/www/app/lib/bitmask.js
@@ -96,6 +96,28 @@ var bitmask = function(){
};
return {
+ bonafide: {
+ provider: {
+ create: function(domain) {
+ return call(['bonafide', 'provider', 'create', domain]);
+ },
+
+ read: function(domain) {
+ return call(['bonafide', 'provider', 'read', domain]);
+ },
+
+ delete: function(domain) {
+ return call(['bonafide', 'provider', 'delete', domain]);
+ },
+
+ list: function(seeded) {
+ if (typeof seeded !== 'boolean') {
+ seeded = false;
+ }
+ return call(['bonafide', 'provider', 'list', seeded]);
+ }
+ },
+
/**
* uids are of the form user@provider.net
*/
@@ -106,7 +128,7 @@ var bitmask = function(){
* @return {Promise<string>} The uid of the active user
*/
active: function() {
- return call(['user', 'active']);
+ return call(['bonafide', 'user', 'active']);
},
/**
@@ -114,19 +136,27 @@ var bitmask = function(){
*
* @param {string} uid The uid to be created
* @param {string} password The user password
+ * @param {boolean} autoconf If the provider should be autoconfigured if it's not allready known
*/
- create: function(uid, password) {
- return call(['user', 'create', uid, password]);
- },
+ create: function(uid, password, autoconf) {
+ if (typeof autoconf !== 'boolean') {
+ autoconf = false;
+ }
+ return call(['bonafide', 'user', 'create', uid, password, autoconf]);
+ },
/**
* Login
*
* @param {string} uid The uid to log in
* @param {string} password The user password
+ * @param {boolean} autoconf If the provider should be autoconfigured if it's not allready known
*/
- auth: function(uid, password) {
- return call(['user', 'authenticate', uid, password]);
+ auth: function(uid, password, autoconf) {
+ if (typeof autoconf !== 'boolean') {
+ autoconf = false;
+ }
+ return call(['bonafide', 'user', 'authenticate', uid, password, autoconf]);
},
/**
@@ -136,11 +166,11 @@ var bitmask = function(){
* If no uid is provided the active user will be used
*/
logout: function(uid) {
- if (typeof uid !== 'string') {
- uid = "";
- }
- return call(['user', 'logout', uid]);
- }
+ if (typeof uid !== 'string') {
+ uid = "";
+ }
+ return call(['bonafide', 'user', 'logout', uid]);
+ }
},
mail: {