diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-09-13 12:13:38 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-09-13 12:13:38 -0400 |
| commit | 299a10fd77c12a2585abdd3010b93c9cd36ec863 (patch) | |
| tree | c40f34ac6c12dad49bda5473e7ee4ae3b111e09d /www | |
| parent | 80f997741d3b96a640ca3ea7cc74d43159f5ed7e (diff) | |
#704 more fixes for basic auth profiles
Diffstat (limited to 'www')
| -rw-r--r-- | www/js/LoginCtrl.js | 2 | ||||
| -rw-r--r-- | www/js/MenuController.js | 12 | ||||
| -rwxr-xr-x | www/js/app.js | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index 923e1baa..5c81a952 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -568,7 +568,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r $rootScope.basicAuthToken = ''; // console.log ("CLEARING AUTH"); } else { - $rootScope.basicAuthToken = btoa($scope.loginData.basicAuthUser + ':' + $scope.loginData.basicAuthPassword); + $rootScope.basicAuthToken = btoa(loginData.basicAuthUser + ':' + loginData.basicAuthPassword); $rootScope.basicAuthHeader = 'Basic ' + $rootScope.basicAuthToken; } diff --git a/www/js/MenuController.js b/www/js/MenuController.js index 254c73c9..abe2e80c 100644 --- a/www/js/MenuController.js +++ b/www/js/MenuController.js @@ -50,6 +50,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io $rootScope.alarmCount = 0; $rootScope.isAlarm = false; + // First lets kill current stuf NVRDataModel.debug ("** Resetting existing server"); @@ -62,11 +63,22 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io NVRDataModel.debug ("**Switching to new server..."); + NVRDataModel.clearZmsMultiPortSupport(); var zmServers = NVRDataModel.getServerGroups(); var loginData = zmServers[s]; NVRDataModel.debug("Retrieved state for this profile:" + JSON.stringify(loginData)); NVRDataModel.setLogin(loginData); + if (!loginData.isUseBasicAuth) { + $rootScope.basicAuthHeader = ''; + $rootScope.basicAuthToken = ''; + // console.log ("CLEARING AUTH"); + } else { + $rootScope.basicAuthToken = btoa(loginData.basicAuthUser + ':' + loginData.basicAuthPassword); + $rootScope.basicAuthHeader = 'Basic ' + $rootScope.basicAuthToken; + + } + if (loginData.isUseEventServer) { EventServer.init(); if ($rootScope.apnsToken && loginData.disablePush != true) { diff --git a/www/js/app.js b/www/js/app.js index 54e2067a..6287e09b 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -1055,7 +1055,7 @@ angular.module('zmApp', [ //first login using new API - var loginAPI = loginData.apiurl + '/host/logins.json'; + var loginAPI = loginData.apiurl + '/host/login.json'; $http({ |
