Merge pull request #3476 from gabrielbazan7/feat/deleteWords
adding security preferences
This commit is contained in:
commit
be3d979548
7 changed files with 174 additions and 50 deletions
|
|
@ -2,7 +2,13 @@
|
|||
|
||||
angular.module('copayApp.controllers').controller('preferencesController',
|
||||
function($scope, $rootScope, $timeout, $log, configService, profileService) {
|
||||
|
||||
|
||||
var fc = profileService.focusedClient;
|
||||
$scope.deleted = false;
|
||||
if (fc.credentials && !fc.credentials.mnemonicEncrypted && !fc.credentials.mnemonic) {
|
||||
$scope.deleted = true;
|
||||
}
|
||||
|
||||
this.init = function() {
|
||||
var config = configService.getSync();
|
||||
var fc = profileService.focusedClient;
|
||||
|
|
@ -37,8 +43,8 @@ angular.module('copayApp.controllers').controller('preferencesController',
|
|||
});
|
||||
});
|
||||
} else {
|
||||
if (!val && fc.hasPrivKeyEncrypted()) {
|
||||
profileService.unlockFC(function(err){
|
||||
if (!val && fc.hasPrivKeyEncrypted()) {
|
||||
profileService.unlockFC(function(err) {
|
||||
if (err) {
|
||||
$scope.encrypt = true;
|
||||
return;
|
||||
|
|
@ -70,14 +76,13 @@ angular.module('copayApp.controllers').controller('preferencesController',
|
|||
opts.touchIdFor[walletId] = newVal;
|
||||
|
||||
$rootScope.$emit('Local/RequestTouchid', function(err) {
|
||||
if (err) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
$timeout(function() {
|
||||
$scope.touchidError = true;
|
||||
$scope.touchid = oldVal;
|
||||
}, 100);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
configService.set(opts, function(err) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
|
|
|
|||
23
src/js/controllers/preferencesDeleteWords.js
Normal file
23
src/js/controllers/preferencesDeleteWords.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController',
|
||||
function(confirmDialog, notification, profileService, go, gettext) {
|
||||
var self = this;
|
||||
var fc = profileService.focusedClient;
|
||||
var msg = gettext('Are you sure you want to delete the backup words?');
|
||||
var successMsg = gettext('Backup words deleted');
|
||||
|
||||
self.delete = function() {
|
||||
confirmDialog.show(msg,
|
||||
function(ok) {
|
||||
if (ok) {
|
||||
fc.clearMnemonic();
|
||||
profileService.updateCredentialsFC(function() {
|
||||
notification.success(successMsg);
|
||||
go.walletHome();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
12
src/js/controllers/securityPreferences.js
Normal file
12
src/js/controllers/securityPreferences.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('securityPreferencesController',
|
||||
function($scope, profileService) {
|
||||
var self = this;
|
||||
var fc = profileService.focusedClient;
|
||||
self.deleted = false;
|
||||
if (fc.credentials && !fc.credentials.mnemonicEncrypted && !fc.credentials.mnemonic) {
|
||||
self.deleted = true;
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -286,29 +286,30 @@ angular
|
|||
},
|
||||
}
|
||||
})
|
||||
.state('preferencesColor', {
|
||||
url: '/preferencesColor',
|
||||
templateUrl: 'views/preferencesColor.html',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesColor.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
.state('preferencesAltCurrency', {
|
||||
url: '/preferencesAltCurrency',
|
||||
templateUrl: 'views/preferencesAltCurrency.html',
|
||||
.state('preferencesColor', {
|
||||
url: '/preferencesColor',
|
||||
templateUrl: 'views/preferencesColor.html',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesAltCurrency.html'
|
||||
templateUrl: 'views/preferencesColor.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
.state('preferencesAltCurrency', {
|
||||
url: '/preferencesAltCurrency',
|
||||
templateUrl: 'views/preferencesAltCurrency.html',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesAltCurrency.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('preferencesAlias', {
|
||||
url: '/preferencesAlias',
|
||||
templateUrl: 'views/preferencesAlias.html',
|
||||
|
|
@ -345,6 +346,17 @@ angular
|
|||
|
||||
}
|
||||
})
|
||||
.state('deleteWords', {
|
||||
url: '/deleteWords',
|
||||
templateUrl: 'views/preferencesDeleteWords.html',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesDeleteWords.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('delete', {
|
||||
url: '/delete',
|
||||
templateUrl: 'views/preferencesDeleteWallet.html',
|
||||
|
|
@ -368,16 +380,16 @@ angular
|
|||
})
|
||||
|
||||
.state('about', {
|
||||
url: '/about',
|
||||
templateUrl: 'views/preferencesAbout.html',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesAbout.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
url: '/about',
|
||||
templateUrl: 'views/preferencesAbout.html',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesAbout.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('logs', {
|
||||
url: '/logs',
|
||||
templateUrl: 'views/preferencesLogs.html',
|
||||
|
|
@ -439,14 +451,14 @@ angular
|
|||
})
|
||||
|
||||
.state('add', {
|
||||
url: '/add',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/add.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
url: '/add',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/add.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('cordova', {
|
||||
url: '/cordova/:status/:isHome',
|
||||
views: {
|
||||
|
|
@ -525,7 +537,7 @@ angular
|
|||
|
||||
$state.transitionTo('copayers');
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
if (!animationService.transitionAnimated(fromState, toState)) {
|
||||
event.preventDefault();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue