diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-11-14 14:17:25 -0500 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-11-14 14:17:25 -0500 |
| commit | c652eda24f3caa446815194f32b78d049fa99076 (patch) | |
| tree | b12a1d8cbc39a8f3283d2202d14f87cc3a9e0acd /www/js | |
| parent | c7e5dc8f53079e4e5f90c974b30c704b61f8d020 (diff) | |
Initial commits - #83
Former-commit-id: 2ee7fa15e0bd6964a5437a537aa4ebca5c0428c9
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/DataModel.js | 3 | ||||
| -rw-r--r-- | www/js/LogCtrl.js | 2 | ||||
| -rw-r--r-- | www/js/LoginCtrl.js | 17 |
3 files changed, 19 insertions, 3 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index f948e38b..9f6b6451 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -27,6 +27,7 @@ angular.module('zmApp.controllers') var serverGroupList={}; var loginData = { + 'serverName':'', 'username': '', 'password': '', 'url': '', // This is the ZM portal path @@ -107,7 +108,7 @@ angular.module('zmApp.controllers') zmDebug ("DataModel/setLogin: writing " + JSON.stringify(newLogin)); $localstorage.setObject($rootScope.currentServerGroup, loginData); - serverGroupList[$rootScope.currentServerGroup]=loginData; + serverGroupList[loginData.serverName]=loginData; console.log (JSON.stringify(serverGroupList)); $localstorage.setObject("serverlist", serverGroupList); diff --git a/www/js/LogCtrl.js b/www/js/LogCtrl.js index d544e419..ac027ccc 100644 --- a/www/js/LogCtrl.js +++ b/www/js/LogCtrl.js @@ -1,6 +1,6 @@ /* jshint -W041 */ /* jslint browser: true*/ -/* global saveAs, cordova,StatusBar,angular,console */ +/* global saveAs, cordova,StatusBar,angular,console,moment */ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$rootScope','zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$fileLogger', '$cordovaEmailComposer', '$ionicPopup', '$timeout', '$ionicHistory', '$state', '$interval', function ($scope, $rootScope,zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $fileLogger, $cordovaEmailComposer, $ionicPopup, $timeout, $ionicHistory, $state, $interval) { $scope.openMenu = function () { diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index 1199d78a..27673c54 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -176,6 +176,8 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r function saveItems() { + + console.log('Saving login'); ZMDataModel.setFirstUse(false); @@ -324,7 +326,20 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r } $scope.saveItems = function () { - saveItems(); + + if (!$scope.loginData.serverName) + { + $ionicPopup.alert({ + title:'Error', + template: 'Server Name cannot be empty', + }) + .then(function(res) + {return;}); + } + else + { + saveItems(); + } }; |
