delete fc from preferences
This commit is contained in:
parent
965619740b
commit
4e599c38e7
24 changed files with 173 additions and 243 deletions
|
|
@ -1,20 +1,24 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', function($scope, confirmDialog, lodash, notification, profileService, go, gettext) {
|
||||
var fc = profileService.focusedClient;
|
||||
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', function($scope, $state, $stateParams, confirmDialog, lodash, notification, profileService, walletService, gettext) {
|
||||
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var msg = gettext('Are you sure you want to delete the recovery phrase?');
|
||||
var successMsg = gettext('Recovery phrase deleted');
|
||||
|
||||
if (lodash.isEmpty(fc.credentials.mnemonic) && lodash.isEmpty(fc.credentials.mnemonicEncrypted))
|
||||
walletService.needsBackup(wallet, function(needsBackup) {
|
||||
$scope.needsBackup = needsBackup;
|
||||
});
|
||||
if (lodash.isEmpty(wallet.credentials.mnemonic) && lodash.isEmpty(wallet.credentials.mnemonicEncrypted))
|
||||
$scope.deleted = true;
|
||||
|
||||
$scope.delete = function() {
|
||||
confirmDialog.show(msg, function(ok) {
|
||||
if (ok) {
|
||||
fc.clearMnemonic();
|
||||
profileService.updateCredentials(JSON.parse(fc.export()), function() {
|
||||
wallet.clearMnemonic();
|
||||
profileService.updateCredentials(JSON.parse(wallet.export()), function() {
|
||||
notification.success(successMsg);
|
||||
go.walletHome();
|
||||
$state.go('wallet.details');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue