]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix identation
authorStefan Yohansson <stefan@evolux.net.br>
Thu, 24 Sep 2015 13:11:48 +0000 (10:11 -0300)
committerKen Rice <krice@freeswitch.org>
Fri, 25 Sep 2015 15:08:09 +0000 (10:08 -0500)
html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js

index bae60ac31edb1e26347726ca3037b087f3d69f98..c9f3e5b74ea639a21caf43e9b996ee9e951f323d 100644 (file)
@@ -1,60 +1,24 @@
 (function() {
-       'use strict';
-
-       angular
-       .module('vertoControllers')
-       .controller('LoginController', ['$scope', '$http', '$location', 'verto', 
-               function($scope, $http, $location, verto) {
-                               $scope.checkBrowser();
-
-                       /*
-                        * Load the Configs before logging in
-                        * with cache buster
-                        */
-
-                       $http.get(window.location.pathname + '/config.json?cachebuster=' + Math.floor((Math.random()*1000000)+1))
-                               .success(function(data) {
-
-                               /* save these for later as we're about to possibly over write them */
-                               var name = verto.data.name;
-                               var email = verto.data.email;
-
-                               console.debug("googlelogin: " + data.googlelogin);
-                               if (data.googlelogin){
-                                       $scope.googlelogin = data.googlelogin;
-                                       $scope.googleclientid = data.googleclientid;
-                               }
-
-                               angular.extend(verto.data, data);
-
-                               /**
-                                * use stored data (localStorage) for login, allow config.json to take precedence
-                                */
-
-                               if (name != '' && data.name == '') {
-                                       verto.data.name = name;
-                               }
-                               if (email != '' && data.email == '') {
-                                       verto.data.email = email;
-                               }
-                               if (verto.data.login == '' && verto.data.password == '' && $scope.storage.data.login != '' && $scope.storage.data.password != '') {
-                                       verto.data.login = $scope.storage.data.login;
-                                       verto.data.password = $scope.storage.data.password;
-                               }
-
-                               if (verto.data.autologin == "true" && !verto.data.autologin_done) {
-                                       console.debug("auto login per config.json");
-                                       verto.data.autologin_done = true;
-                                       $scope.login();
-                               }
-                       });
-
-                       verto.data.name = $scope.storage.data.name;
-                       verto.data.email = $scope.storage.data.email;
-
-                       console.debug('Executing LoginController.');
-               }
-       ]);
+  'use strict';
+
+  angular
+    .module('vertoControllers')
+    .controller('LoginController', ['$scope', '$http', '$location', 'verto', 
+      function($scope, $http, $location, verto) {
+        var preRoute = function() {
+          if(verto.data.connected) {
+            $location.path('/dialpad');
+          }
+        }
+        preRoute();
+
+
+        verto.data.name = $scope.storage.data.name;
+        verto.data.email = $scope.storage.data.email;
+
+        console.debug('Executing LoginController.');
+      }
+    ]);
 
 })();