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
|
|
@ -9,8 +9,8 @@
|
|||
<div class="content preferences" ng-controller="preferencesController as preferences" ng-init="preferences.init()">
|
||||
|
||||
<h4></h4>
|
||||
<ul class="no-bullet m0" ng-show="!index.noFocusedWallet">
|
||||
|
||||
<ul class="no-bullet m0" ng-show="!index.noFocusedWallet">
|
||||
|
||||
<li ng-click="$root.go('preferencesAlias')">
|
||||
<div class="right text-gray">
|
||||
|
|
@ -45,8 +45,6 @@
|
|||
<div translate>Hardware wallet</div>
|
||||
</li>
|
||||
|
||||
<h4>
|
||||
</h4>
|
||||
<li ng-click="$root.go('backup')" ng-hide="index.isPrivKeyExternal">
|
||||
<div class="right text-gray">
|
||||
<span class="text-warning" ng-show="index.needsBackup">
|
||||
|
|
@ -56,28 +54,46 @@
|
|||
</div>
|
||||
<div translate>Backup</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li ng-click="$root.go('preferencesAdvanced')">
|
||||
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
||||
<div translate>Advanced</div>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h4 translate ng-show="index.canSign || !deleted">
|
||||
Security preferences
|
||||
</h4>
|
||||
|
||||
<div ng-show="!index.noFocusedWallet && index.canSign">
|
||||
<h4 translate ng-show="index.canSign">
|
||||
Spending Restrictions
|
||||
</h4>
|
||||
|
||||
<ul class="no-bullet m0">
|
||||
|
||||
<li>
|
||||
<switch id="network-name" name="encrypt" ng-model="encrypt" class="green right"></switch>
|
||||
<div translate>Request Password</div>
|
||||
</li>
|
||||
|
||||
<li ng-show="preferences.touchidAvailable">
|
||||
<switch id="touchid" name="touchid" ng-model="touchid" class="green right"></switch>
|
||||
<div translate>Scan Fingerprint</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h4></h4>
|
||||
|
||||
</div>
|
||||
<div ng-show ="!deleted">
|
||||
|
||||
<ul class="no-bullet m0">
|
||||
<li ng-click="$root.go('deleteWords')">
|
||||
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
||||
<div translate>Delete seed words</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<h4></h4>
|
||||
</div>
|
||||
|
||||
<div class="extra-margin-bottom"></div>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
<div class="content preferences" ng-controller="preferencesAdvancedController as preferences">
|
||||
|
||||
<h4></h4>
|
||||
|
||||
<ul class="no-bullet m0">
|
||||
|
||||
<li ng-click="$root.go('information')">
|
||||
|
|
@ -26,14 +27,16 @@
|
|||
|
||||
<li ng-click="$root.go('preferencesBwsUrl')">
|
||||
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
||||
<span>Wallet Service URL</span>
|
||||
<div>Wallet Service URL</div>
|
||||
</li>
|
||||
|
||||
<li ng-click="$root.go('delete')">
|
||||
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
||||
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
||||
<div translate>Delete Wallet</div>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="extra-margin-bottom"></div>
|
||||
|
||||
|
|
|
|||
53
public/views/preferencesDeleteWords.html
Normal file
53
public/views/preferencesDeleteWords.html
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<div
|
||||
class="topbar-container"
|
||||
ng-include="'views/includes/topbar.html'"
|
||||
ng-init="titleSection='Delete Seed Words'; goBackToState = 'preferences'">
|
||||
</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 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>
|
||||
|
||||
<p class="size-14 text-gray" ng-show="index.needsBackup" >
|
||||
<span translate>
|
||||
Need to do backup
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<button class="button round expand warning" ng-disabled="index.needsBackup" ng-click="preferences.delete()">
|
||||
<i class="fi-trash"></i>
|
||||
<span translate>
|
||||
DELETE WORDS
|
||||
</span>
|
||||
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -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