2015-11-16 17:43:54 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
2016-06-04 16:19:19 -03:00
|
|
|
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController', function(confirmDialog, lodash, notification, profileService, go, gettext) {
|
|
|
|
|
var self = this;
|
|
|
|
|
var fc = profileService.focusedClient;
|
|
|
|
|
var msg = gettext('Are you sure you want to delete the recovery phrase?');
|
|
|
|
|
var successMsg = gettext('Recovery phrase deleted');
|
2015-11-16 17:43:54 -03:00
|
|
|
|
2016-06-04 16:19:19 -03:00
|
|
|
if (lodash.isEmpty(fc.credentials.mnemonic) && lodash.isEmpty(fc.credentials.mnemonicEncrypted))
|
|
|
|
|
self.deleted = true;
|
2015-12-04 13:30:51 -03:00
|
|
|
|
2016-06-04 16:19:19 -03:00
|
|
|
self.delete = function() {
|
|
|
|
|
confirmDialog.show(msg, function(ok) {
|
|
|
|
|
if (ok) {
|
|
|
|
|
fc.clearMnemonic();
|
2016-06-06 18:26:45 -03:00
|
|
|
profileService.updateCredentials(fc.export(), function() {
|
2016-06-04 16:19:19 -03:00
|
|
|
notification.success(successMsg);
|
|
|
|
|
go.walletHome();
|
2015-11-16 17:43:54 -03:00
|
|
|
});
|
2016-06-04 16:19:19 -03:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
});
|