From 7cb24d55f47dc28d91710d5c22cfc30a0a59b583 Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 14 Mar 2019 14:22:29 -0400 Subject: #784 well what the heck, password for desktops --- www/js/LoginCtrl.js | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'www/js/LoginCtrl.js') diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index 44f69d04..fef2c1ce 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -371,7 +371,72 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r // When PIN is enabled, this is called to specify a PIN // FIXME: Get rid of cordovaPinDialog. It's really not needed //-------------------------------------------------------------------------- + $scope.pinPrompt = function (evt) { + NVR.log ("use password:"+$scope.loginData.usePin); + + if (!$scope.loginData.usePin) { + return; + } + + if ($rootScope.platformOS == 'desktop') { + desktopPinConfig(); + } + else { + mobilePinConfig(); + } + } + + + function desktopPinConfig() { + + $scope.data = {}; + // An elaborate, custom popup + var myPopup = $ionicPopup.show({ + template: ''+$translate.instant('kPinProtect')+'
'+$translate.instant('kReconfirmPin')+'', + title: $translate.instant('kPinProtect'), + scope: $scope, + buttons: [ + { text: 'Cancel', + type: 'button-assertive', + onTap: function (e) { + $scope.loginData.usePin = false; + } + }, + { + text: 'Save', + type: 'button-positive', + onTap: function(e) { + if (!$scope.data.p1) { + //don't allow the user to close unless he enters wifi password + e.preventDefault(); + } else { + if ($scope.data.p1 == $scope.data.p2) { + NVR.log ("Pin code match"); + $scope.loginData.pinCode = $scope.data.p1; + } + else { + $ionicLoading.show({ + template: $translate.instant('kBannerPinMismatch') + "...", + noBackdrop: true, + duration: 1500 + }); + NVR.log ("Pin code mistmatch match"); + $scope.loginData.usePin = false; + e.preventDefault(); + } + + } + } + } + ] + }); + + +} + + +function mobilePinConfig () { NVR.log("Password prompt"); if ($scope.loginData.usePin) { $scope.loginData.pinCode = ""; -- cgit v1.2.3