From 511281af2a0a410d661aa19e10d49b40a41fb13c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Baz=C3=A1n?= Date: Mon, 22 May 2017 15:36:38 -0300 Subject: [PATCH 1/6] adding verification option to passphrase on create personal wallet --- src/js/controllers/create.js | 32 +++++++++++++++++++++--------- src/sass/views/tab-settings.scss | 15 ++++++++++++++ www/views/tab-create-personal.html | 29 +++++++++++++++++++++++---- 3 files changed, 63 insertions(+), 13 deletions(-) diff --git a/src/js/controllers/create.js b/src/js/controllers/create.js index 8a18d6b2d..1de0e754e 100644 --- a/src/js/controllers/create.js +++ b/src/js/controllers/create.js @@ -29,27 +29,41 @@ angular.module('copayApp.controllers').controller('createController', $scope.formData.derivationPath = derivationPathHelper.default; $scope.setTotalCopayers(tc); updateRCSelect(tc); + resetPasswordFields(); }; $scope.showAdvChange = function() { $scope.showAdv = !$scope.showAdv; + $scope.encrypt = null; $scope.resizeView(); }; + $scope.checkPassword = function(pw1, pw2) { + if (pw1 && pw1.length > 0) { + if (pw2 && pw2.length > 0) { + if (pw1 == pw2) $scope.result = 'correct'; + else { + $scope.formData.passwordSaved = null; + $scope.result = 'incorrect'; + } + } else + $scope.result = null; + } else + $scope.result = null; + }; + $scope.resizeView = function() { $timeout(function() { $ionicScrollDelegate.resize(); }, 10); - checkPasswordFields(); + resetPasswordFields(); }; - function checkPasswordFields() { - if (!$scope.encrypt) { - $scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = null; - $timeout(function() { - $scope.$apply(); - }); - } + function resetPasswordFields() { + $scope.formData.passphrase = $scope.formData.createPassphrase = $scope.formData.passwordSaved = $scope.formData.repeatpassword = $scope.result = null; + $timeout(function() { + $scope.$apply(); + }); }; function updateRCSelect(n) { @@ -64,7 +78,7 @@ angular.module('copayApp.controllers').controller('createController', id: 'new', label: gettextCatalog.getString('Random'), supportsTestnet: true - }, { + }, { id: 'set', label: gettextCatalog.getString('Specify Recovery Phrase...'), supportsTestnet: false diff --git a/src/sass/views/tab-settings.scss b/src/sass/views/tab-settings.scss index 08d87ef94..2cf1d9efa 100644 --- a/src/sass/views/tab-settings.scss +++ b/src/sass/views/tab-settings.scss @@ -95,6 +95,21 @@ font-size: 16px; } } + input[type="password"] { + border: none; + margin-left: -5px; + padding-left: 4px; + &.incorrect { + margin-right: 10px; + border: 1px solid; + color: #C90505; + } + &.correct { + margin-right: 10px; + border: 1px solid; + color: #00901B; + } + } } #tab-settings { diff --git a/www/views/tab-create-personal.html b/www/views/tab-create-personal.html index e532165c9..ca3c89546 100644 --- a/www/views/tab-create-personal.html +++ b/www/views/tab-create-personal.html @@ -35,7 +35,7 @@
Wallet Key
- +