adding verification option to passphrase on create personal wallet

This commit is contained in:
Gabriel Bazán 2017-05-22 15:36:38 -03:00
commit 511281af2a
3 changed files with 63 additions and 13 deletions

View file

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

View file

@ -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 {

View file

@ -35,7 +35,7 @@
<div class="input-label" translate>
Wallet Key
</div>
<select class="m10t" ng-model="seedSource" ng-options="seed as seed.label for seed in seedOptions"></select>
<select class="m10t" ng-model="seedSource" ng-options="seed as seed.label for seed in seedOptions" ng-change="resizeView()"></select>
</label>
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'trezor' || seedSource.id == 'ledger'">
@ -66,20 +66,41 @@
placeholder="{{'Password'|translate}}"
type="password"
autocapitalize="off"
ng-model="formData.createPassphrase">
ng-model="formData.createPassphrase"
ng-change="checkPassword(formData.createPassphrase, formData.repeatpassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
<input ng-show="seedSource.id == 'set'"
placeholder="{{'Password'|translate}}"
type="password"
autocapitalize="off"
ng-model="formData.passphrase">
ng-model="formData.passphrase"
ng-change="checkPassword(formData.passphrase, formData.repeatpassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
</div>
<div class="item item-input" ng-show="encrypt">
<input ng-show="seedSource.id == 'new'"
placeholder="{{'Repeat password'|translate}}"
type="password"
autocapitalize="off"
ng-model="formData.repeatpassword"
ng-change="checkPassword(formData.createPassphrase, formData.repeatpassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
<input ng-show="seedSource.id == 'set'"
placeholder="{{'Repeat password'|translate}}"
type="password"
autocapitalize="off"
ng-model="formData.repeatpassword"
ng-change="checkPassword(formData.passphrase, formData.repeatpassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
</div>
<div class="text-center box-notification error" ng-show="(seedSource.id =='new' || seedSource.id =='set') && encrypt">
<strong translate>This password cannot be recovered. If the password is lost, there is no way you could recover your funds.</strong>
</div>
<ion-checkbox ng-model="formData.passwordSaved" class="checkbox-positive" ng-show="encrypt">
<ion-checkbox ng-model="formData.passwordSaved" class="checkbox-positive" ng-show="encrypt && result == 'correct'">
<span class="toggle-label" translate>I have written it down</span>
</ion-checkbox>