diff options
Diffstat (limited to 'js/codeq/comms.js')
-rw-r--r-- | js/codeq/comms.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/js/codeq/comms.js b/js/codeq/comms.js index 3671e95..54a912f 100644 --- a/js/codeq/comms.js +++ b/js/codeq/comms.js @@ -297,10 +297,29 @@ }); }; if (socket) return performLogin(); - // this is the only method where we do connect() first, if we're not already connected + // this is the 1st method where we do connect() first, if we're not already connected return this.connect().then(performLogin); }, + 'logout': function () { + return this.send({'action': 'logout'}); + }, + + 'signup': function (username, password) { + var myself = this, + performSignUp = function () { + return myself.send({'action': 'signup', 'username': username, 'password': password}); + }; + + if (socket) return performSignUp(); + // this is the 2nd method where we do connect() first, if we're not already connected + return this.connect().then(performSignUp); + }, + + 'changePassword': function (newpassword) { + return this.send({'action': 'change_password', 'password': newpassword}); + }, + 'updateSettings': function (new_settings){ return this.send({'action': 'settings', 'sid': sid, 'settings': new_settings}); }, |