summaryrefslogtreecommitdiff
path: root/js/codeq/comms.js
diff options
context:
space:
mode:
authorMarko Pušnik <marko.pusnik@guru.si>2015-10-05 19:59:05 +0200
committerMarko Pušnik <marko.pusnik@guru.si>2015-10-05 19:59:05 +0200
commit2f415bc811f7378091bd2285e9e822cb39eed3e6 (patch)
treeeff58afa8468334c4ae21b16b4d2367af3047816 /js/codeq/comms.js
parent4a53a4594018fc6e538c87f7321ffefadc5edbd3 (diff)
sign up, reset password and profile pages + related comm messages
Diffstat (limited to 'js/codeq/comms.js')
-rw-r--r--js/codeq/comms.js21
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});
},