security preferences in wallet preferences

This commit is contained in:
Gabriel Bazán 2015-11-18 15:14:09 -03:00
commit eef61bfd51
6 changed files with 84 additions and 74 deletions

View file

@ -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,17 +54,45 @@
</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>
</li>
</ul>
<h4 translate ng-show="index.canSign || !deleted">
Security preferences
</h4>
<div ng-show="!index.noFocusedWallet && index.canSign">
<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>
<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>
</div>
<div class="extra-margin-bottom"></div>

View file

@ -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,9 +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 translate>Wallet Service URL</div>
</li>
<li ng-click="$root.go('delete')">
<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>

View file

@ -1,35 +1,53 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Delete Seed Words'; goBackToState = 'securityPreferences'">
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 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>
<p translate class="size-14 text-gray" ng-show="index.needsBackup" > <span translate>
Need to do backup
</span></p>
<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>
<p translate 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()" translate>
<i class="fi-trash"></i>
<span translate>
DELETE WORDS
</span>
<i class="fi-trash"></i>
<span translate>
DELETE WORDS
</span>
</button>
</div>
</div>
</div>

View file

@ -1,35 +0,0 @@
<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('delete')">
<i class="icon-arrow-right3 size-24 right text-gray"></i>
<div translate>Delete Wallet</div>
</li>
<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>
<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>

View file

@ -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);

View file

@ -286,18 +286,6 @@ 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',