summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rwxr-xr-xwww/js/DataModel.js2
-rw-r--r--www/js/LoginCtrl.js21
-rw-r--r--www/js/PortalLoginCtrl.js2
-rwxr-xr-xwww/js/app.js5
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;