diff options
author | Marko Pušnik <marko.pusnik@guru.si> | 2015-10-05 19:59:05 +0200 |
---|---|---|
committer | Marko Pušnik <marko.pusnik@guru.si> | 2015-10-05 19:59:05 +0200 |
commit | 2f415bc811f7378091bd2285e9e822cb39eed3e6 (patch) | |
tree | eff58afa8468334c4ae21b16b4d2367af3047816 /js/codeq/comms.js | |
parent | 4a53a4594018fc6e538c87f7321ffefadc5edbd3 (diff) |
sign up, reset password and profile pages + related comm messages
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}); }, |