diff options
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/WizardCtrl.js | 3 | ||||
| -rwxr-xr-x | www/js/app.js | 51 |
2 files changed, 27 insertions, 27 deletions
diff --git a/www/js/WizardCtrl.js b/www/js/WizardCtrl.js index 62bc213c..20029ed1 100644 --- a/www/js/WizardCtrl.js +++ b/www/js/WizardCtrl.js @@ -14,6 +14,9 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$ function login(u, zmu, zmp) { var d = $q.defer(); + + + $http({ method: 'POST', //withCredentials: true, diff --git a/www/js/app.js b/www/js/app.js index 518cd5db..e6bce4bd 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -1032,46 +1032,43 @@ angular.module('zmApp', [ //first login using new API - var loginAPI = loginData.apiurl + '/host/getVersion.json?user=' + loginData.username + "&pass=" + loginData.password; + var loginAPI = loginData.apiurl + '/host/login.json?user=' + loginData.username + "&pass=" + loginData.password; $http.get(loginAPI) .then(function (succ) { - console.log("******************* NEW API LOGIN RETURNED " + JSON.stringify(succ)); + NVRDataModel.debug ("API based login returned: "+JSON.stringify(succ)); NVRDataModel.setCurrentServerVersion(succ.data.version); $ionicLoading.hide(); $rootScope.loggedIntoZm = 1; + $rootScope.authSession = ''; + + if (succ.data.credentials) { + $rootScope.authSession = "&" + succ.data.credentials; + if (succ.data.append_password == '1') { + $rootScope.authSession = $rootScope.authSession + + loginData.password; + } + } + + NVRDataModel.log("Stream authentication construction: " + + $rootScope.authSession); + NVRDataModel.log("zmAutologin successfully logged into Zoneminder via API"); + /* + { + "credentials": "auth=fsdfdsfsd, + "append_password": 0, + "version": "1.31.44", + "apiversion": "1.0" + } + */ + d.resolve("Login Success"); $rootScope.$broadcast('auth-success', succ); - // Now go ahead and re-get auth key - // if login was a success - $rootScope.authSession = "undefined"; - var ld = NVRDataModel.getLogin(); - NVRDataModel.getAuthKey($rootScope.validMonitorId) - .then(function (success) { - - //console.log(success); - $rootScope.authSession = success; - NVRDataModel.log("Stream authentication construction: " + - $rootScope.authSession); - - }, - function (error) { - //console.log(error); - - NVRDataModel.log("Modal: Error returned Stream authentication construction. Retaining old value of: " + $rootScope.authSession); - NVRDataModel.debug("Error was: " + JSON.stringify(error)); - }); - - - - - - }, function (err) { console.log("******************* API login error " + JSON.stringify(err)); |
