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()"> <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">
@ -57,16 +55,44 @@
<div translate>Backup</div> <div translate>Backup</div>
</li> </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')"> <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>
<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> </ul>
</div> </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> <div class="extra-margin-bottom"></div>

View file

@ -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,9 +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 translate>Wallet Service URL</div>
</li> </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> </ul>
</div> </div>
<div class="extra-margin-bottom"></div> <div class="extra-margin-bottom"></div>

View file

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

@ -3,6 +3,12 @@
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;
@ -76,8 +82,7 @@ angular.module('copayApp.controllers').controller('preferencesController',
$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);

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', { .state('preferencesAdvanced', {
url: '/preferencesAdvanced', url: '/preferencesAdvanced',
templateUrl: 'views/preferencesAdvanced.html', templateUrl: 'views/preferencesAdvanced.html',