Wallet/src/js/controllers/preferencesDeleteWords.js

23 lines
968 B
JavaScript
Raw Normal View History

'use strict';
2016-08-30 17:07:49 -03:00
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', function($scope, $ionicHistory, $stateParams, $ionicNavBarDelegate, gettextCatalog, confirmDialog, lodash, profileService, gettext) {
2016-08-29 16:48:15 -03:00
$ionicNavBarDelegate.title(gettextCatalog.getString('Delete recovery phrase'));
2016-08-17 15:53:17 -03:00
var wallet = profileService.getWallet($stateParams.walletId);
2016-06-04 16:19:19 -03:00
var msg = gettext('Are you sure you want to delete the recovery phrase?');
var successMsg = gettext('Recovery phrase deleted');
2016-08-30 17:07:49 -03:00
$scope.needsBackup = wallet.needsBackup;
2016-08-17 15:53:17 -03:00
if (lodash.isEmpty(wallet.credentials.mnemonic) && lodash.isEmpty(wallet.credentials.mnemonicEncrypted))
$scope.deleted = true;
2015-12-04 13:30:51 -03:00
$scope.delete = function() {
2016-06-04 16:19:19 -03:00
confirmDialog.show(msg, function(ok) {
if (ok) {
2016-08-17 15:53:17 -03:00
wallet.clearMnemonic();
profileService.updateCredentials(JSON.parse(wallet.export()), function() {
2016-08-29 16:48:15 -03:00
$ionicHistory.goBack();
});
2016-06-04 16:19:19 -03:00
}
});
};
});