fix config.lock options by default
This commit is contained in:
parent
f75b43f21e
commit
ef0addc29d
2 changed files with 10 additions and 8 deletions
|
|
@ -4,18 +4,18 @@ angular.module('copayApp.controllers').controller('lockController', function($st
|
|||
|
||||
function init() {
|
||||
var config = configService.getSync();
|
||||
$scope.locking = config.lock.method != 'pin';
|
||||
$scope.locking = config.lock && config.lock.method == 'pin' ? false : true;
|
||||
|
||||
$scope.options = [
|
||||
{
|
||||
method: 'none',
|
||||
method: '',
|
||||
label: gettextCatalog.getString('Disabled'),
|
||||
value: config.lock.method == '',
|
||||
selected: config.lock && config.lock.method == '' ? true : false,
|
||||
},
|
||||
{
|
||||
method: 'pin',
|
||||
label: gettextCatalog.getString('Enable PIN'),
|
||||
value: config.lock.method == 'pin',
|
||||
selected: config.lock && config.lock.method == 'pin' ? true : false,
|
||||
needsBackup: null,
|
||||
},
|
||||
];
|
||||
|
|
@ -24,12 +24,12 @@ angular.module('copayApp.controllers').controller('lockController', function($st
|
|||
$scope.options.push({
|
||||
method: 'fingerprint',
|
||||
label: gettextCatalog.getString('Enable Fingerprint'),
|
||||
value: config.lock.method == 'fingerprint',
|
||||
selected: config.lock && config.lock.method == 'fingerprint' ? true : false,
|
||||
needsBackup: null,
|
||||
});
|
||||
}
|
||||
|
||||
$scope.currentOption = lodash.find($scope.options, 'value');
|
||||
$scope.currentOption = lodash.find($scope.options, 'selected') || $scope.options[0];
|
||||
processWallets();
|
||||
};
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ angular.module('copayApp.controllers').controller('lockController', function($st
|
|||
};
|
||||
|
||||
$scope.select = function(method) {
|
||||
if (method == 'none')
|
||||
if (method == '')
|
||||
saveConfig();
|
||||
else if (method == 'fingerprint') {
|
||||
var config = configService.getSync();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ angular.module('copayApp.controllers').controller('pinController', function($sta
|
|||
|
||||
$scope.$on("$ionicView.enter", function(event) {
|
||||
configService.whenAvailable(function(config) {
|
||||
if (!config.lock) return;
|
||||
$scope.bannedUntil = config.lock.bannedUntil || null;
|
||||
if ($scope.bannedUntil) {
|
||||
var now = Math.floor(Date.now() / 1000);
|
||||
|
|
@ -156,12 +157,13 @@ angular.module('copayApp.controllers').controller('pinController', function($sta
|
|||
|
||||
function saveSettings(method, value) {
|
||||
var config = configService.getSync();
|
||||
var attempts = config.lock && config.lock.attempts ? config.lock.attempts : 0;
|
||||
var opts = {
|
||||
lock: {
|
||||
method: method || '',
|
||||
value: value || '',
|
||||
bannedUntil: null,
|
||||
attempts: config.lock.attempts + 1,
|
||||
attempts: attempts + 1,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue