summary refs log tree commit diff
path: root/webclient/login/login-controller.js
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-08-14 13:57:55 +0100
committerKegan Dougal <kegan@matrix.org>2014-08-14 13:57:55 +0100
commit613e468b89cac37e4537b1798aee98d824b55cb3 (patch)
tree7ac7cff1d640abc6e0a1b3c7eeb5af8518619bec /webclient/login/login-controller.js
parentAdded M_UNKNOWN_TOKEN error code and send it when there is an unrecognised ac... (diff)
downloadsynapse-613e468b89cac37e4537b1798aee98d824b55cb3.tar.xz
Guess the home server URL on the login screen by inspecting the URL of the web client.
Diffstat (limited to '')
-rw-r--r--webclient/login/login-controller.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/webclient/login/login-controller.js b/webclient/login/login-controller.js
index 26590da686..fa91bf4253 100644
--- a/webclient/login/login-controller.js
+++ b/webclient/login/login-controller.js
@@ -3,8 +3,16 @@ angular.module('LoginController', ['matrixService'])
                                     function($scope, $location, matrixService) {
     'use strict';
     
+    
+    // Assume that this is hosted on the home server, in which case the URL
+    // contains the home server.
+    var hs_url = $location.protocol() + "://" + $location.host();
+    if ($location.port()) {
+        hs_url += ":" + $location.port();
+    }
+    
     $scope.account = {
-        homeserver: "http://localhost:8080",
+        homeserver: hs_url,
         desired_user_name: "",
         user_id: "",
         password: "",