From e7b50e87260313c51367bf7c3c9f638b105ab645 Mon Sep 17 00:00:00 2001 From: Stefan Yohansson Date: Thu, 24 Sep 2015 15:49:24 -0300 Subject: [PATCH] FS-8205 [verto_communicator] fix login config and checkConfig --- .../storageService/services/splash_screen.js | 17 +---------------- .../controllers/MainController.js | 14 +++++++++++--- .../src/vertoService/services/configService.js | 2 ++ 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js index 3537313bbe..4cb97e7fd1 100644 --- a/html5/verto/verto_communicator/src/storageService/services/splash_screen.js +++ b/html5/verto/verto_communicator/src/storageService/services/splash_screen.js @@ -101,22 +101,7 @@ result['promise'] = configPromise; - var connectCallback = function(v, connected) { - verto.data.connecting = false; - if (connected) { - storage.data.ui_connected = verto.data.connected; - storage.data.ws_connected = verto.data.connected; - storage.data.name = verto.data.name; - storage.data.email = verto.data.email; - storage.data.login = verto.data.login; - storage.data.password = verto.data.password; - resolve(result); - } - }; - - verto.data.connecting = true; - verto.connect(connectCallback); - + resolve(result); }); }; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js index 4dd6879731..fc403843ec 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js @@ -30,12 +30,18 @@ console.debug('MainController: WebSocket not connected. Redirecting to login.'); $location.path('/'); } - + + $rootScope.$on('config.http.success', function(ev) { + $scope.login(false); + }); /** * Login the user to verto server and * redirects him to dialpad page. */ - $scope.login = function() { + $scope.login = function(redirect) { + if(redirect == undefined) { + redirect = true; + } var connectCallback = function(v, connected) { $scope.$apply(function() { verto.data.connecting = false; @@ -46,7 +52,9 @@ storage.data.email = verto.data.email; storage.data.login = verto.data.login; storage.data.password = verto.data.password; - $location.path('/dialpad'); + if (redirect) { + $location.path('/dialpad'); + } } }); }; diff --git a/html5/verto/verto_communicator/src/vertoService/services/configService.js b/html5/verto/verto_communicator/src/vertoService/services/configService.js index 2c302b6ad1..4ac73e0ee9 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/configService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/configService.js @@ -61,8 +61,10 @@ vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', ' verto.data.autologin_done = true; } + $rootScope.$emit('config.http.success', data); return response; }, function(response) { + $rootScope.$emit('config.http.error', response); return response; });