adding delete words option to security Preferences

This commit is contained in:
Gabriel Bazán 2015-11-16 17:43:54 -03:00
parent 95217cef02
commit 7b3e308e25
6 changed files with 150 additions and 35 deletions

View File

@ -56,7 +56,12 @@
</div>
<div translate>Backup</div>
</li>
<li ng-click="$root.go('securityPreferences')">
<i class="icon-arrow-right3 size-24 right text-gray"></i>
<div translate>Security Preferences</div>
</li>
<li ng-click="$root.go('preferencesAdvanced')">
<i class="icon-arrow-right3 size-24 right text-gray"></i>
<div translate>Advanced</div>

View File

@ -0,0 +1,32 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Delete Seed Words'; goBackToState = 'securityPreferences'">
</div>
<div class="content preferences" ng-controller="preferencesDeleteWordsController as preferences">
<h4></h4>
<div class="text-center text-gray">
<span translate>Wallet</span>: {{index.walletName}}
<span ng-show="index.alias">({{index.alias}})</span>
</div>
<h4 class="text-warning text-center m0" translate>Warning!</h4>
<div class="box-notification" ng-show="preferences.error" >
<span class="text-warning size-14">
{{preferences.error|translate}}
</span>
</div>
<div class="columns text-center">
<p translate class="size-14 text-gray" ng-show="!index.needsBackup" > <span translate>
Once you have copied your wallet seed down, it is recommended to delete it from this device.
</span></p>
<button class="button round expand warning" ng-disabled="index.needsBackup" ng-click="preferences.delete()" translate>
<i class="fi-trash"></i>
<span translate>
DELETE WORDS
</span>
</button>
</div>
</div>

View File

@ -0,0 +1,19 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Security'; goBackToState = 'preferences'">
</div>
<div class="content preferences" ng-controller="securityPreferencesController as security" >
<h4></h4>
<ul class="no-bullet m0" ng-show="!index.noFocusedWallet">
<li ng-click="$root.go('deleteWords')" ng-show ="!security.deleted">
<i class="icon-arrow-right3 size-24 right text-gray"></i>
<div translate>Delete seed words</div>
</li>
</ul>

View File

@ -0,0 +1,23 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWordsController',
function($scope, $rootScope, $filter, $timeout, $modal, $log, confirmDialog, storageService, notification, profileService, isCordova, go, gettext, gettextCatalog, animationService) {
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();
});
}
});
};
});

View 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;
}
});

View File

@ -286,6 +286,18 @@ angular
}
})
.state('securityPreferences', {
url: '/securityPreferences',
templateUrl: 'views/securityPreferences.html',
walletShouldBeComplete: true,
needProfile: true,
views: {
'main': {
templateUrl: 'views/securityPreferences.html'
},
}
})
.state('preferencesAdvanced', {
url: '/preferencesAdvanced',
templateUrl: 'views/preferencesAdvanced.html',
@ -297,29 +309,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',
@ -356,6 +369,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',
@ -379,16 +403,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',
@ -450,14 +474,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: {
@ -539,7 +563,7 @@ angular
$state.transitionTo('copayers');
event.preventDefault();
}
}
if (!animationService.transitionAnimated(fromState, toState)) {
event.preventDefault();