summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--www/js/LoginCtrl.js24
1 files changed, 19 insertions, 5 deletions
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index efaa08e7..d1130bd3 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -155,17 +155,31 @@ function addhttp(url) {
// fail in app.js that will be called to show an error
// box
- // Note that API auth ties into ZM Auth, so in one fell
- // swoop we've just validated both. Happy?
.then( function(data)
{
- //console.log ("THE DATA WAS " + data);
- //console.log ("SHOWING POPUP ");
- $ionicPopup.alert({
+ // Now let's validate if the API works
+ // https://github.com/pliablepixels/zmNinja/issues/25
+ ZMDataModel.zmLog ("Validating APIs at " + apiurl);
+ $http.get(apiurl)
+ .success (function (data) {
+ $ionicPopup.alert({
title: 'Login validated',
template: 'Please explore the menu and enjoy zmNinja!'
}).then(function(res) { $ionicSideMenuDelegate.toggleLeft();});
+
+ })
+ .error (function (error) {
+ ZMDataModel.displayBanner ('error',['ZoneMinder API check failed', 'Please check API settings']);
+ ZMDataModel.zmLog ("API login error " + JSON.stringify(error));
+ $ionicPopup.alert({
+ title: 'Login validated but API failed',
+ template: 'Please check your API settings'
+ });
+ });
+
+
+
});
};