summary refs log tree commit diff
path: root/webclient/components
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-08-22 15:48:09 +0100
committerErik Johnston <erik@matrix.org>2014-08-22 15:48:09 +0100
commit239622f80b7576770aea2b5e0cdd30975f8977fe (patch)
tree02fbd576e039e6d1b88e7b9c424231ee96f78249 /webclient/components
parentMove the 'Upgrade' section to just below the 'Installation' section (diff)
parentUpdater command line client to new IS API (diff)
downloadsynapse-239622f80b7576770aea2b5e0cdd30975f8977fe.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into release-v0.0.1
Diffstat (limited to 'webclient/components')
-rw-r--r--webclient/components/matrix/matrix-service.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/webclient/components/matrix/matrix-service.js b/webclient/components/matrix/matrix-service.js
index fa5a6091d3..d5738e01c8 100644
--- a/webclient/components/matrix/matrix-service.js
+++ b/webclient/components/matrix/matrix-service.js
@@ -79,7 +79,6 @@ angular.module('matrixService', [])
         return $http(request);
     };
 
-
     return {
         /****** Home server API ******/
         prefix: prefixPath,
@@ -310,17 +309,25 @@ angular.module('matrixService', [])
         },
 
         // hit the Identity Server for a 3PID request.
-        linkEmail: function(email) {
+        linkEmail: function(email, clientSecret, sendAttempt) {
             var path = "/matrix/identity/api/v1/validate/email/requestToken"
-            var data = "clientSecret=abc123&email=" + encodeURIComponent(email);
+            var data = "clientSecret="+clientSecret+"&email=" + encodeURIComponent(email)+"&sendAttempt="+sendAttempt;
             var headers = {};
             headers["Content-Type"] = "application/x-www-form-urlencoded";
             return doBaseRequest(config.identityServer, "POST", path, {}, data, headers); 
         },
 
-        authEmail: function(userId, tokenId, code) {
+        authEmail: function(clientSecret, tokenId, code) {
             var path = "/matrix/identity/api/v1/validate/email/submitToken";
-            var data = "token="+code+"&mxId="+encodeURIComponent(userId)+"&tokenId="+tokenId;
+            var data = "token="+code+"&sid="+tokenId+"&clientSecret="+clientSecret;
+            var headers = {};
+            headers["Content-Type"] = "application/x-www-form-urlencoded";
+            return doBaseRequest(config.identityServer, "POST", path, {}, data, headers);
+        },
+
+        bindEmail: function(userId, tokenId, clientSecret) {
+            var path = "/matrix/identity/api/v1/3pid/bind";
+            var data = "mxid="+encodeURIComponent(userId)+"&sid="+tokenId+"&clientSecret="+clientSecret;
             var headers = {};
             headers["Content-Type"] = "application/x-www-form-urlencoded";
             return doBaseRequest(config.identityServer, "POST", path, {}, data, headers); 
@@ -393,6 +400,7 @@ angular.module('matrixService', [])
         // Set a new config (Use saveConfig to actually store it permanently)
         setConfig: function(newConfig) {
             config = newConfig;
+            console.log("new IS: "+config.identityServer);
         },
         
         // Commits config into permanent storage