Merge pull request #5506 from JDonadio/ref/match-passwords-03

Export wallet - password hinting
This commit is contained in:
Matias Alejo Garcia 2017-01-26 10:34:03 -03:00 committed by GitHub
commit b896c75f3d
3 changed files with 32 additions and 2 deletions

View File

@ -16,6 +16,17 @@ angular.module('copayApp.controllers').controller('exportController',
}, 10);
};
$scope.checkPassword = function(pw1, pw2) {
if (pw1.length > 0) {
if (pw2.length > 0) {
if (pw1 == pw2) $scope.result = 'correct';
else $scope.result = 'incorrect';
} else
$scope.result = null;
} else
$scope.result = null;
};
function getPassword(cb) {
if ($scope.password) return cb(null, $scope.password);
@ -57,6 +68,7 @@ angular.module('copayApp.controllers').controller('exportController',
var init = function() {
$scope.formData = {};
$scope.formData.password = $scope.formData.repeatpassword = '';
$scope.isEncrypted = wallet.isPrivKeyEncrypted();
$scope.isCordova = platformInfo.isCordova;
$scope.isSafari = platformInfo.isSafari;
@ -214,6 +226,7 @@ angular.module('copayApp.controllers').controller('exportController',
};
$scope.formData.exportWalletInfo = null;
$scope.password = null;
$scope.result = null;
});
});

View File

@ -12,4 +12,19 @@
border-bottom-width: 2px;
border-bottom-color: #172565;
}
input[type="password"] {
border: none;
margin-left: -5px;
padding-left: 4px;
&.incorrect {
padding-left: 3px;
border: 1px solid;
color: #C90505;
}
&.correct {
padding-left: 3px;
border: 1px solid;
color: #00901B;
}
}
}

View File

@ -8,12 +8,14 @@
<div class="list">
<label class="item item-input item-stacked-label">
<span class="input-label" translate>Set up a password</span>
<input type="password" placeholder="{{'Your password'|translate}}" ng-model="formData.password">
<input type="password" placeholder="{{'Your password'|translate}}" ng-model="formData.password" ng-change="checkPassword(formData.password, formData.repeatpassword)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
</label>
<label class="item item-input item-stacked-label">
<span class="input-label" translate>Repeat the password</span>
<input type="password" placeholder="{{'Repeat password'|translate}}" ng-model="formData.repeatpassword">
<input type="password" placeholder="{{'Repeat password'|translate}}" ng-model="formData.repeatpassword" ng-change="checkPassword(formData.repeatpassword, formData.password)"
ng-class="{'correct': result == 'correct', 'incorrect': result == 'incorrect'}">
</label>
<div ng-show="canSign">