diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-01-08 10:43:25 -0500 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-01-08 10:43:25 -0500 |
| commit | af2b59902e50264a9a34f4ca0a5bdf06ecc13b8d (patch) | |
| tree | a1d40b5d9e610a30c40ef73cfe0e37a451437cf7 /www/js | |
| parent | e4ab4d9769331713288040f96044e188d15d6d49 (diff) | |
#499 - fix case when you try and configure ES before logging into portal (first setup)
Diffstat (limited to 'www/js')
| -rwxr-xr-x | www/js/DataModel.js | 2 | ||||
| -rw-r--r-- | www/js/LoginCtrl.js | 21 | ||||
| -rw-r--r-- | www/js/PortalLoginCtrl.js | 2 | ||||
| -rwxr-xr-x | www/js/app.js | 5 |
4 files changed, 25 insertions, 5 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index afaad752..47ec1156 100755 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -1100,7 +1100,7 @@ angular.module('zmApp.controllers') } }, - isLoggedIn: function () { + hasLoginInfo: function () { if ((loginData.username != "" && loginData.password != "" && loginData.url != "" && loginData.apiurl != "") || (loginData.isUseAuth != '1')) { diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index b27a1203..7956950b 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -249,8 +249,25 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r NVRDataModel.debug("Saving settings before going to Event Server settings"); //console.log ( "My loginData saved " + JSON.stringify($scope.loginData)); NVRDataModel.setLogin($scope.loginData); - $state.go("app.eventserversettings"); - return; + + + if (!$rootScope.isLoggedIn) { + $rootScope.zmPopup = $ionicPopup.alert( + { + title: $translate.instant('kError'), + template: $translate.instant('kEventServerNotLoggedIn'), + okText: $translate.instant('kButtonOk'), + cancelText: $translate.instant('kButtonCancel'), + }); + return; + + } + else { + $state.go("app.eventserversettings"); + return; + } + + }; //------------------------------------------------------------------------- diff --git a/www/js/PortalLoginCtrl.js b/www/js/PortalLoginCtrl.js index e1cf5343..a7d25f84 100644 --- a/www/js/PortalLoginCtrl.js +++ b/www/js/PortalLoginCtrl.js @@ -27,7 +27,7 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic $scope.pinPrompt = false; // if true, then PIN is displayed else skip - if (NVRDataModel.isLoggedIn()) + if (NVRDataModel.hasLoginInfo()) { NVRDataModel.log("User credentials are provided"); diff --git a/www/js/app.js b/www/js/app.js index 1a226155..cf608567 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -865,6 +865,8 @@ angular.module('zmApp', [ //------------------------------------------------------------------ $rootScope.$on("auth-success", function () { + + $rootScope.isLoggedIn = true; var contentBannerInstance = $ionicContentBanner.show({ text: ['ZoneMinder' + $translate.instant('kAuthSuccess')], interval: 2000, @@ -1238,6 +1240,7 @@ angular.module('zmApp', [ //console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>INSIDE RUN"); $rootScope.textScaleFactor = 1.0; + $rootScope.isLoggedIn = false; $rootScope.apiValid = false; $rootScope.db = null; @@ -1451,7 +1454,7 @@ angular.module('zmApp', [ } - if (NVRDataModel.isLoggedIn() || toState.data.requireLogin == false) { + if (NVRDataModel.hasLoginInfo() || toState.data.requireLogin == false) { //console.log("State transition is authorized"); return; |
