From 7b3e308e25c9436eb23ac3d09fec7f9ae48c8c8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 16 Nov 2015 17:43:54 -0300 Subject: [PATCH 1/5] adding delete words option to security Preferences --- public/views/preferences.html | 7 +- public/views/preferencesDeleteWords.html | 32 +++++++ public/views/securityPreferences.html | 19 ++++ src/js/controllers/preferencesDeleteWords.js | 23 +++++ src/js/controllers/securityPreferences.js | 12 +++ src/js/routes.js | 92 ++++++++++++-------- 6 files changed, 150 insertions(+), 35 deletions(-) create mode 100644 public/views/preferencesDeleteWords.html create mode 100644 public/views/securityPreferences.html create mode 100644 src/js/controllers/preferencesDeleteWords.js create mode 100644 src/js/controllers/securityPreferences.js diff --git a/public/views/preferences.html b/public/views/preferences.html index ff31aaa0f..7af803f41 100644 --- a/public/views/preferences.html +++ b/public/views/preferences.html @@ -56,7 +56,12 @@
Backup
- + +
  • + +
    Security Preferences
    +
  • +
  • Advanced
    diff --git a/public/views/preferencesDeleteWords.html b/public/views/preferencesDeleteWords.html new file mode 100644 index 000000000..218845048 --- /dev/null +++ b/public/views/preferencesDeleteWords.html @@ -0,0 +1,32 @@ +
    +
    + + +
    + +

    +
    + Wallet: {{index.walletName}} + ({{index.alias}}) +
    +

    Warning!

    +
    + + {{preferences.error|translate}} + +
    +
    +

    + Once you have copied your wallet seed down, it is recommended to delete it from this device. +

    + +
    +
    diff --git a/public/views/securityPreferences.html b/public/views/securityPreferences.html new file mode 100644 index 000000000..f9754ff50 --- /dev/null +++ b/public/views/securityPreferences.html @@ -0,0 +1,19 @@ +
    +
    + + +
    + +

    + +
      + +
    • + +
      Delete seed words
      +
    • + +
    diff --git a/src/js/controllers/preferencesDeleteWords.js b/src/js/controllers/preferencesDeleteWords.js new file mode 100644 index 000000000..6c14ba9ea --- /dev/null +++ b/src/js/controllers/preferencesDeleteWords.js @@ -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(); + }); + } + }); + }; + + }); diff --git a/src/js/controllers/securityPreferences.js b/src/js/controllers/securityPreferences.js new file mode 100644 index 000000000..b864ae2eb --- /dev/null +++ b/src/js/controllers/securityPreferences.js @@ -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; + } + + }); diff --git a/src/js/routes.js b/src/js/routes.js index 44f7ca551..0e2da59b8 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -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(); From 1c841e5f217082b7452efb65ef3853b4ec13f166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Wed, 18 Nov 2015 10:41:06 -0300 Subject: [PATCH 2/5] moving delete wallet and request password to security preferences --- public/views/preferences.html | 16 ------------ public/views/preferencesAdvanced.html | 5 ---- public/views/preferencesDeleteWords.html | 3 +++ public/views/securityPreferences.html | 32 ++++++++++++++++++------ 4 files changed, 27 insertions(+), 29 deletions(-) diff --git a/public/views/preferences.html b/public/views/preferences.html index 7af803f41..1b905d09e 100644 --- a/public/views/preferences.html +++ b/public/views/preferences.html @@ -67,22 +67,6 @@
    Advanced
  • -
    -

    - Spending Restrictions -

    - -
    -

    diff --git a/public/views/preferencesAdvanced.html b/public/views/preferencesAdvanced.html index 1fc70c1a0..195914114 100644 --- a/public/views/preferencesAdvanced.html +++ b/public/views/preferencesAdvanced.html @@ -28,11 +28,6 @@ Wallet Service URL - -
  • - -
    Delete Wallet
    -
  • diff --git a/public/views/preferencesDeleteWords.html b/public/views/preferencesDeleteWords.html index 218845048..0025f6808 100644 --- a/public/views/preferencesDeleteWords.html +++ b/public/views/preferencesDeleteWords.html @@ -22,6 +22,9 @@

    Once you have copied your wallet seed down, it is recommended to delete it from this device.

    +

    + Need to do backup +

    + - + + diff --git a/public/views/securityPreferences.html b/public/views/securityPreferences.html deleted file mode 100644 index 3ee9fce2e..000000000 --- a/public/views/securityPreferences.html +++ /dev/null @@ -1,35 +0,0 @@ -
    -
    - -
    -

    - -
    -

    - Spending Restrictions -

    -
      -
    • - -
      Request Password
      -
    • -
    • - -
      Scan Fingerprint
      -
    • -
    -
    -

    diff --git a/src/js/controllers/preferences.js b/src/js/controllers/preferences.js index 1701f16be..046d4e6da 100644 --- a/src/js/controllers/preferences.js +++ b/src/js/controllers/preferences.js @@ -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); diff --git a/src/js/routes.js b/src/js/routes.js index 0e2da59b8..b2baef96c 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -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', From ebedb64237d1ca62b043506afe7edb1d5d0f6e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Thu, 19 Nov 2015 15:15:36 -0300 Subject: [PATCH 4/5] refactor --- public/views/preferences.html | 1 + public/views/preferencesAdvanced.html | 2 +- public/views/preferencesDeleteWords.html | 4 ++-- src/js/controllers/preferencesDeleteWords.js | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/public/views/preferences.html b/public/views/preferences.html index a75e66212..8cd8e7649 100644 --- a/public/views/preferences.html +++ b/public/views/preferences.html @@ -93,6 +93,7 @@
    +

    diff --git a/public/views/preferencesAdvanced.html b/public/views/preferencesAdvanced.html index 52bb3634f..47a043629 100644 --- a/public/views/preferencesAdvanced.html +++ b/public/views/preferencesAdvanced.html @@ -27,7 +27,7 @@
  • -
    Wallet Service URL
    +
    Wallet Service URL
  • diff --git a/public/views/preferencesDeleteWords.html b/public/views/preferencesDeleteWords.html index 796ec99bf..d63f27be6 100644 --- a/public/views/preferencesDeleteWords.html +++ b/public/views/preferencesDeleteWords.html @@ -34,13 +34,13 @@

    -

    +

    Need to do backup

    -