summary refs log tree commit diff
path: root/webclient/login/login-controller.js
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2014-08-31 00:40:42 +0100
committerMatthew Hodgson <matthew@matrix.org>2014-08-31 00:40:42 +0100
commit1bc036a12d6877f78f1f5033603d803ac01a13d2 (patch)
tree00408a44816b73132c2aa640346733c3264eb47b /webclient/login/login-controller.js
parentfactor out mobile css into its own file (diff)
downloadsynapse-1bc036a12d6877f78f1f5033603d803ac01a13d2.tar.xz
nasty big monolithic commit of a whole bunch of UI/UX improvements:
 - add a simple CSS template across the app for navigation & cosmetics
 - split login into login & register, and totally reskin it
 - restructure room CSS to play nicely with it
 - implement basis 1:1 chat from user pages
 - disable autofocus on iOS to improve UX
Diffstat (limited to 'webclient/login/login-controller.js')
-rw-r--r--webclient/login/login-controller.js59
1 files changed, 11 insertions, 48 deletions
diff --git a/webclient/login/login-controller.js b/webclient/login/login-controller.js
index 51f9a3bdf4..2b91926954 100644
--- a/webclient/login/login-controller.js
+++ b/webclient/login/login-controller.js
@@ -10,63 +10,26 @@ angular.module('LoginController', ['matrixService'])
     if ($location.port()) {
         hs_url += ":" + $location.port();
     }
+    var example_domain = $location.host();
     
     $scope.account = {
         homeserver: hs_url,
+        example_domain: example_domain,
         desired_user_name: "",
         user_id: "",
         password: "",
-        identityServer: "",
+        identityServer: "http://matrix.org:8090",
         pwd1: "",
-        pwd2: ""
+        pwd2: "",
     };
-
-    $scope.register = function() {
-
-        // Set the urls
-        matrixService.setConfig({
-            homeserver: $scope.account.homeserver,
-            identityServer: $scope.account.identityServer
-        });
-        
-        if ($scope.account.pwd1 !== $scope.account.pwd2) {
-            $scope.feedback = "Passwords don't match.";
-            return;
-        }
-        else if ($scope.account.pwd1.length < 6) {
-            $scope.feedback = "Password must be at least 6 characters.";
-            return;
-        }
-
-        matrixService.register($scope.account.desired_user_name, $scope.account.pwd1).then(
-            function(response) {
-                $scope.feedback = "Success";
-                // Update the current config 
-                var config = matrixService.config();
-                angular.extend(config, {
-                    access_token: response.data.access_token,
-                    user_id: response.data.user_id
-                });
-                matrixService.setConfig(config);
-
-                // And permanently save it
-                matrixService.saveConfig();
-                eventStreamService.resume();
-                 // Go to the user's rooms list page
-                $location.url("home");
-            },
-            function(error) {
-                if (error.data) {
-                    if (error.data.errcode === "M_USER_IN_USE") {
-                        $scope.feedback = "Username already taken.";
-                    }
-                }
-                else if (error.status === 0) {
-                    $scope.feedback = "Unable to talk to the server.";
-                }
-            });
+    
+    $scope.login_types = [ "email", "mxid" ];
+    $scope.login_type_label = {
+        "email": "Email address",
+        "mxid": "Matrix ID (e.g. @bob:matrix.org or bob)",
     };
-
+    $scope.login_type = 'mxid'; // TODO: remember the user's preferred login_type
+    
     $scope.login = function() {
         matrixService.setConfig({
             homeserver: $scope.account.homeserver,