summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--www/css/style.css11
-rw-r--r--www/img/background.pngbin0 -> 1930992 bytes
-rw-r--r--www/js/PortalLoginCtrl.js153
-rw-r--r--www/templates/zm-portal-login.html14
4 files changed, 95 insertions, 83 deletions
diff --git a/www/css/style.css b/www/css/style.css
index 58ab4b27..54a093a5 100644
--- a/www/css/style.css
+++ b/www/css/style.css
@@ -405,8 +405,17 @@ input[type=range]::-webkit-slider-thumb {
width:200px;
text-align: center;
font-size: 2em;
- border: 1px solid #000;
+ border: 1px solid #ddd;
+ -webkit-appearance: none;
}
+
+
+.pin-background.scroll-content
+ {
+ background: url('../img/background.png') no-repeat;
+ background-size: cover;
+}
+
/*.mySliderClass.jslider.sliderCSS div.jslider-pointer
{top:-10px;left:15px;width:60px;height:60px;margin-left:-5px;background-color:silver;background-color:#615959;border-radius:50%
}*/
diff --git a/www/img/background.png b/www/img/background.png
new file mode 100644
index 00000000..65eaa94e
--- /dev/null
+++ b/www/img/background.png
Binary files differ
diff --git a/www/js/PortalLoginCtrl.js b/www/js/PortalLoginCtrl.js
index 11f7543b..6b5e9259 100644
--- a/www/js/PortalLoginCtrl.js
+++ b/www/js/PortalLoginCtrl.js
@@ -3,109 +3,112 @@
/*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
-
-
- $ionicHistory.nextViewOptions({
- disableBack: true
- });
-
- $scope.pindata = {};
- if ($ionicSideMenuDelegate.isOpen())
- {
- $ionicSideMenuDelegate.toggleLeft();
- ZMDataModel.zmDebug("Sliding menu close");
- }
+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) {
+
+
+ //-------------------------------------------------------------------------------
+ // remove status is pin is empty
+ //-------------------------------------------------------------------------------
- $scope.pinChange = function()
- {
-
- console.log ($scope.pindata.pin);
- if ($scope.pindata.pin == null)
- {
- console.log ("Empty");
- $scope.pindata.status="";
+ $scope.pinChange = function () {
+ if ($scope.pindata.pin == null) {
+ $scope.pindata.status = "";
}
};
-
- $scope.unlock = function()
- {
+
+ //-------------------------------------------------------------------------------
+ // unlock app if PIN is correct
+ //-------------------------------------------------------------------------------
+ $scope.unlock = function () {
ZMDataModel.zmDebug("Trying to unlock PIN");
- if ($scope.pindata.pin == loginData.pinCode)
- {
- ZMDataModel.zmDebug ("PIN code entered is correct");
+ if ($scope.pindata.pin == loginData.pinCode) {
+ ZMDataModel.zmDebug("PIN code entered is correct");
$rootScope.rand = Math.floor((Math.random() * 100000) + 1);
zmAutoLogin.stop(); //safety
zmAutoLogin.start();
zmAutoLogin.doLogin("authenticating...")
- .then (function(data) // success
- {
- ZMDataModel.zmDebug("PortalLogin: auth success");
- ZMDataModel.getKeyConfigParams(1);
+ .then(function (data) // success
+ {
+ ZMDataModel.zmDebug("PortalLogin: auth success");
+ ZMDataModel.getKeyConfigParams(1);
$state.go('montage');
- },
- // coming here means auth error
- // so go back to login
- function (error)
- {
+ },
+ // coming here means auth error
+ // so go back to login
+ function (error) {
ZMDataModel.zmDebug("PortalLogin: error authenticating " +
- JSON.stringify(error));
+ JSON.stringify(error));
$state.go('login');
- });
- }
- else
- {
+ });
+ } else {
$scope.pindata.status = "Invalid PIN";
+
+ // wobble the input box on error
+ var element = angular.element(document.getElementById("pin-box"));
+
+ element.addClass("animated shake")
+ .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',
+ function () {
+ element.removeClass("animated shake");
+ });
}
};
+
+ //-------------------------------------------------------------------------------
+ // Controller Main
+ //-------------------------------------------------------------------------------
+
+
+ $ionicHistory.nextViewOptions({
+ disableBack: true
+ });
+
+ $scope.pindata = {};
+ if ($ionicSideMenuDelegate.isOpen()) {
+ $ionicSideMenuDelegate.toggleLeft();
+ ZMDataModel.zmDebug("Sliding menu close");
+ }
+
var loginData = ZMDataModel.getLogin();
- $scope.pinPrompt = false;
+ $scope.pinPrompt = false; // if true, then PIN is displayed else skip
if (ZMDataModel.isLoggedIn()) {
- ZMDataModel.zmLog ("User credentials are provided");
-
- if (loginData.usePin)
- {
+ ZMDataModel.zmLog("User credentials are provided");
+
+ if (loginData.usePin) {
$scope.pinPrompt = true;
-
-
- }
- else{
-
- ZMDataModel.zmDebug ("PIN code not set");
+
+
+ }
+ else // no PIN Code so skip
+ {
+
+ ZMDataModel.zmDebug("PIN code not set");
$rootScope.rand = Math.floor((Math.random() * 100000) + 1);
zmAutoLogin.stop(); //safety
zmAutoLogin.start();
zmAutoLogin.doLogin("authenticating...")
- .then (function(data) // success
- {
- ZMDataModel.zmDebug("PortalLogin: auth success");
- ZMDataModel.getKeyConfigParams(1);
+ .then(function (data) // success
+ {
+ ZMDataModel.zmDebug("PortalLogin: auth success");
+ ZMDataModel.getKeyConfigParams(1);
$state.go('montage');
- },
- // coming here means auth error
- // so go back to login
- function (error)
- {
+ },
+ // coming here means auth error
+ // so go back to login
+ function (error) {
ZMDataModel.zmDebug("PortalLogin: error authenticating " +
- JSON.stringify(error));
+ JSON.stringify(error));
$state.go('login');
- });
-
-
+ });
}
-
-
- }
- else
- {
+
+ } else {
ZMDataModel.zmDebug("PortalLogin: Not logged in, so going to login");
$state.go('login');
-
+
}
-
-
+
+
}]); \ No newline at end of file
diff --git a/www/templates/zm-portal-login.html b/www/templates/zm-portal-login.html
index e65504f7..f381faf2 100644
--- a/www/templates/zm-portal-login.html
+++ b/www/templates/zm-portal-login.html
@@ -1,16 +1,16 @@
<ion-view view-title="zmNinja" hide-back-button="true" cache-view="false">
- <ion-content class="padding">
+ <ion-content class="pin-background" scroll="false">
<div ng-if="pinPrompt">
<div style="margin-left:10px; margin-right:10px">
- <center>
- <h4>Enter PIN</h4>
- <div class="pinCode">
- <input type="number" pattern="[0-9]*" ng-model="pindata.pin" ng-keyup="pinChange()" />
+ <center><br/><br/>
+ <span style="color:white">Enter PIN</span>
+ <div class="pinCode">
+ <input id="pin-box" type="number" pattern="[0-9]*" ng-model="pindata.pin" ng-keyup="pinChange()" />
</div>
- <br/> {{pindata.status}}
+ <br/> <span style="color:white">{{pindata.status}}</span>
<br/>
- <button class="button button-block button-stable icon ion-unlocked" ng-click="unlock()"> Unlock
+ <button class="button button-block button-dark icon ion-unlocked" ng-click="unlock()"> Unlock
</button>
</center>
</div>