summaryrefslogtreecommitdiff
path: root/www/js/PortalLoginCtrl.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/PortalLoginCtrl.js')
-rw-r--r--www/js/PortalLoginCtrl.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/www/js/PortalLoginCtrl.js b/www/js/PortalLoginCtrl.js
new file mode 100644
index 00000000..65f92b48
--- /dev/null
+++ b/www/js/PortalLoginCtrl.js
@@ -0,0 +1,36 @@
+/* jshint -W041 */
+/* jshint -W083 */
+/*This is for the loop closure I am using in line 143 */
+/* jslint browser: true*/
+/* global vis,cordova,StatusBar,angular,console,moment */
+angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionicPlatform', '$scope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$rootScope', '$http', '$q', '$state', '$ionicLoading', '$ionicPopover', '$ionicScrollDelegate', '$ionicModal', '$timeout', 'zmAutoLogin', '$ionicHistory',function ($ionicPlatform, $scope, zm, ZMDataModel, $ionicSideMenuDelegate, $rootScope, $http, $q, $state, $ionicLoading, $ionicPopover, $ionicScrollDelegate, $ionicModal, $timeout, zmAutoLogin, $ionicHistory) {
+
+ // Main
+
+console.log ("***** INSIDE LOGIN CONTROLLER");
+
+ $ionicHistory.nextViewOptions({
+ disableBack: true
+ });
+
+ var loginData = ZMDataModel.getLogin();
+
+ if (ZMDataModel.isLoggedIn()) {
+ ZMDataModel.zmLog ("User credentials are provided");
+ // console.log("VALID CREDENTIALS. Grabbing Monitors");
+ zmAutoLogin.doLogin("Logging into ZoneMinder...")
+ .then (function(data)
+ {
+
+ ZMDataModel.getKeyConfigParams(1);
+ $state.go('montage');
+ });
+ }
+ else
+ {
+ $state.go('login');
+
+ }
+
+
+ }]); \ No newline at end of file