From 1bc036a12d6877f78f1f5033603d803ac01a13d2 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 31 Aug 2014 00:40:42 +0100 Subject: 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 --- webclient/login/login-controller.js | 59 +++++++------------------------------ 1 file changed, 11 insertions(+), 48 deletions(-) (limited to 'webclient/login/login-controller.js') 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, -- cgit 1.4.1 From 7ca6d4e8f7651f570196c92c94f9ca4a6b2c0e74 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 31 Aug 2014 15:38:27 +0100 Subject: don't make HS ports explicit if it's the default for the protocol --- webclient/login/login-controller.js | 5 ++++- webclient/login/register-controller.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'webclient/login/login-controller.js') diff --git a/webclient/login/login-controller.js b/webclient/login/login-controller.js index 2b91926954..af9a61f0f0 100644 --- a/webclient/login/login-controller.js +++ b/webclient/login/login-controller.js @@ -7,7 +7,10 @@ angular.module('LoginController', ['matrixService']) // 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()) { + if ($location.port() && + !($location.protocol() === "http" && $location.port() === 80) && + !($location.protocol() === "https" && $location.port() === 443)) + { hs_url += ":" + $location.port(); } var example_domain = $location.host(); diff --git a/webclient/login/register-controller.js b/webclient/login/register-controller.js index 6c1bfd632a..d4fb9add70 100644 --- a/webclient/login/register-controller.js +++ b/webclient/login/register-controller.js @@ -8,7 +8,10 @@ angular.module('RegisterController', ['matrixService']) // 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()) { + if ($location.port() && + !($location.protocol() === "http" && $location.port() === 80) && + !($location.protocol() === "https" && $location.port() === 443)) + { hs_url += ":" + $location.port(); } -- cgit 1.4.1 From df752a15cea3c96e884a27c2fb92e3d4dc7e843f Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 1 Sep 2014 00:42:03 +0100 Subject: licenses, please... --- webclient/login/login-controller.js | 18 ++++++++++++++++-- webclient/login/register-controller.js | 16 ++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) (limited to 'webclient/login/login-controller.js') diff --git a/webclient/login/login-controller.js b/webclient/login/login-controller.js index af9a61f0f0..7369a28ef0 100644 --- a/webclient/login/login-controller.js +++ b/webclient/login/login-controller.js @@ -1,3 +1,19 @@ +/* + Copyright 2014 matrix.org + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + angular.module('LoginController', ['matrixService']) .controller('LoginController', ['$scope', '$location', 'matrixService', 'eventStreamService', function($scope, $location, matrixService, eventStreamService) { @@ -13,11 +29,9 @@ angular.module('LoginController', ['matrixService']) { hs_url += ":" + $location.port(); } - var example_domain = $location.host(); $scope.account = { homeserver: hs_url, - example_domain: example_domain, desired_user_name: "", user_id: "", password: "", diff --git a/webclient/login/register-controller.js b/webclient/login/register-controller.js index d4fb9add70..9659b04ef2 100644 --- a/webclient/login/register-controller.js +++ b/webclient/login/register-controller.js @@ -1,3 +1,19 @@ +/* + Copyright 2014 matrix.org + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + angular.module('RegisterController', ['matrixService']) .controller('RegisterController', ['$scope', '$location', 'matrixService', 'eventStreamService', function($scope, $location, matrixService, eventStreamService) { -- cgit 1.4.1