summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2018-01-08 10:43:25 -0500
committerPliable Pixels <pliablepixels@gmail.com>2018-01-08 10:43:25 -0500
commitaf2b59902e50264a9a34f4ca0a5bdf06ecc13b8d (patch)
treea1d40b5d9e610a30c40ef73cfe0e37a451437cf7 /www
parente4ab4d9769331713288040f96044e188d15d6d49 (diff)
#499 - fix case when you try and configure ES before logging into portal (first setup)
Diffstat (limited to 'www')
-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
-rw-r--r--www/lang/locale-en.json4
5 files changed, 29 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;
diff --git a/www/lang/locale-en.json b/www/lang/locale-en.json
index 229250b1..ac04384f 100644
--- a/www/lang/locale-en.json
+++ b/www/lang/locale-en.json
@@ -110,6 +110,9 @@
"kEventServerVersionBody1" :"You are running version",
"kEventServerVersionBody2" :"Please upgrade to",
"kEventServerVersionTitle" :"Event Server version not supported",
+
+ "kEventServerNotLoggedIn" :"You are not yet logged in. Please make sure you have logged in successfully (save your login data, and ensure login is successful)",
+
"kEventSingleImageScale" :"Event single image scale",
"kEventView" :"Event View",
"kEvents" :"events",
@@ -372,6 +375,7 @@
"kTimelineOnlyDisplaying1" :"only displaying last {{maxItemsVal}} events",
"kTitleNotLoggedIn" :"Not logged in",
"kTitleNotLoggedInBody" :"It doesn't look like you are logged in. For detection to work, you must fill in your login details, portal URL and then tap on Save. Then come back to this feature.",
+
"kTitlePortalNotConfigured" :"Portal not configured",
"kTo" :"to",
"kToDate" :"To Date",