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()">
|
<div class="content preferences" ng-controller="preferencesController as preferences" ng-init="preferences.init()">
|
||||||
|
|
||||||
<h4></h4>
|
<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')">
|
<li ng-click="$root.go('preferencesAlias')">
|
||||||
<div class="right text-gray">
|
<div class="right text-gray">
|
||||||
|
|
@ -45,8 +45,6 @@
|
||||||
<div translate>Hardware wallet</div>
|
<div translate>Hardware wallet</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<h4>
|
|
||||||
</h4>
|
|
||||||
<li ng-click="$root.go('backup')" ng-hide="index.isPrivKeyExternal">
|
<li ng-click="$root.go('backup')" ng-hide="index.isPrivKeyExternal">
|
||||||
<div class="right text-gray">
|
<div class="right text-gray">
|
||||||
<span class="text-warning" ng-show="index.needsBackup">
|
<span class="text-warning" ng-show="index.needsBackup">
|
||||||
|
|
@ -56,28 +54,46 @@
|
||||||
</div>
|
</div>
|
||||||
<div translate>Backup</div>
|
<div translate>Backup</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li ng-click="$root.go('preferencesAdvanced')">
|
<li ng-click="$root.go('preferencesAdvanced')">
|
||||||
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
||||||
<div translate>Advanced</div>
|
<div translate>Advanced</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<h4 translate ng-show="index.canSign || !deleted">
|
||||||
|
Security preferences
|
||||||
|
</h4>
|
||||||
|
|
||||||
<div ng-show="!index.noFocusedWallet && index.canSign">
|
<div ng-show="!index.noFocusedWallet && index.canSign">
|
||||||
<h4 translate ng-show="index.canSign">
|
|
||||||
Spending Restrictions
|
|
||||||
</h4>
|
|
||||||
<ul class="no-bullet m0">
|
<ul class="no-bullet m0">
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<switch id="network-name" name="encrypt" ng-model="encrypt" class="green right"></switch>
|
<switch id="network-name" name="encrypt" ng-model="encrypt" class="green right"></switch>
|
||||||
<div translate>Request Password</div>
|
<div translate>Request Password</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li ng-show="preferences.touchidAvailable">
|
<li ng-show="preferences.touchidAvailable">
|
||||||
<switch id="touchid" name="touchid" ng-model="touchid" class="green right"></switch>
|
<switch id="touchid" name="touchid" ng-model="touchid" class="green right"></switch>
|
||||||
<div translate>Scan Fingerprint</div>
|
<div translate>Scan Fingerprint</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</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>
|
||||||
|
|
||||||
<div class="extra-margin-bottom"></div>
|
<div class="extra-margin-bottom"></div>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<div class="content preferences" ng-controller="preferencesAdvancedController as preferences">
|
<div class="content preferences" ng-controller="preferencesAdvancedController as preferences">
|
||||||
|
|
||||||
<h4></h4>
|
<h4></h4>
|
||||||
|
|
||||||
<ul class="no-bullet m0">
|
<ul class="no-bullet m0">
|
||||||
|
|
||||||
<li ng-click="$root.go('information')">
|
<li ng-click="$root.go('information')">
|
||||||
|
|
@ -26,14 +27,16 @@
|
||||||
|
|
||||||
<li ng-click="$root.go('preferencesBwsUrl')">
|
<li ng-click="$root.go('preferencesBwsUrl')">
|
||||||
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
||||||
<span>Wallet Service URL</span>
|
<div>Wallet Service URL</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li ng-click="$root.go('delete')">
|
<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>
|
<div translate>Delete Wallet</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="extra-margin-bottom"></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',
|
angular.module('copayApp.controllers').controller('preferencesController',
|
||||||
function($scope, $rootScope, $timeout, $log, configService, profileService) {
|
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() {
|
this.init = function() {
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
|
|
@ -37,8 +43,8 @@ angular.module('copayApp.controllers').controller('preferencesController',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (!val && fc.hasPrivKeyEncrypted()) {
|
if (!val && fc.hasPrivKeyEncrypted()) {
|
||||||
profileService.unlockFC(function(err){
|
profileService.unlockFC(function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
$scope.encrypt = true;
|
$scope.encrypt = true;
|
||||||
return;
|
return;
|
||||||
|
|
@ -70,14 +76,13 @@ angular.module('copayApp.controllers').controller('preferencesController',
|
||||||
opts.touchIdFor[walletId] = newVal;
|
opts.touchIdFor[walletId] = newVal;
|
||||||
|
|
||||||
$rootScope.$emit('Local/RequestTouchid', function(err) {
|
$rootScope.$emit('Local/RequestTouchid', function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
$log.debug(err);
|
$log.debug(err);
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.touchidError = true;
|
$scope.touchidError = true;
|
||||||
$scope.touchid = oldVal;
|
$scope.touchid = oldVal;
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
configService.set(opts, function(err) {
|
configService.set(opts, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
$log.debug(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', {
|
.state('preferencesColor', {
|
||||||
url: '/preferencesAltCurrency',
|
url: '/preferencesColor',
|
||||||
templateUrl: 'views/preferencesAltCurrency.html',
|
templateUrl: 'views/preferencesColor.html',
|
||||||
walletShouldBeComplete: true,
|
walletShouldBeComplete: true,
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'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', {
|
.state('preferencesAlias', {
|
||||||
url: '/preferencesAlias',
|
url: '/preferencesAlias',
|
||||||
templateUrl: 'views/preferencesAlias.html',
|
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', {
|
.state('delete', {
|
||||||
url: '/delete',
|
url: '/delete',
|
||||||
templateUrl: 'views/preferencesDeleteWallet.html',
|
templateUrl: 'views/preferencesDeleteWallet.html',
|
||||||
|
|
@ -368,16 +380,16 @@ angular
|
||||||
})
|
})
|
||||||
|
|
||||||
.state('about', {
|
.state('about', {
|
||||||
url: '/about',
|
url: '/about',
|
||||||
templateUrl: 'views/preferencesAbout.html',
|
templateUrl: 'views/preferencesAbout.html',
|
||||||
walletShouldBeComplete: true,
|
walletShouldBeComplete: true,
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
templateUrl: 'views/preferencesAbout.html'
|
templateUrl: 'views/preferencesAbout.html'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('logs', {
|
.state('logs', {
|
||||||
url: '/logs',
|
url: '/logs',
|
||||||
templateUrl: 'views/preferencesLogs.html',
|
templateUrl: 'views/preferencesLogs.html',
|
||||||
|
|
@ -439,14 +451,14 @@ angular
|
||||||
})
|
})
|
||||||
|
|
||||||
.state('add', {
|
.state('add', {
|
||||||
url: '/add',
|
url: '/add',
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
views: {
|
views: {
|
||||||
'main': {
|
'main': {
|
||||||
templateUrl: 'views/add.html'
|
templateUrl: 'views/add.html'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('cordova', {
|
.state('cordova', {
|
||||||
url: '/cordova/:status/:isHome',
|
url: '/cordova/:status/:isHome',
|
||||||
views: {
|
views: {
|
||||||
|
|
@ -525,7 +537,7 @@ angular
|
||||||
|
|
||||||
$state.transitionTo('copayers');
|
$state.transitionTo('copayers');
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!animationService.transitionAnimated(fromState, toState)) {
|
if (!animationService.transitionAnimated(fromState, toState)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue