mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #3874 from cmgustavo/bug/improv-action-setpassword
Enhanced response time when pressing Set/Ok with password enabled
This commit is contained in:
commit
e867a6a0c7
|
@ -16,18 +16,23 @@
|
||||||
|
|
||||||
<div class="input m20t">
|
<div class="input m20t">
|
||||||
<input type="password" placeholder="{{'Your password'|translate}}"
|
<input type="password" placeholder="{{'Your password'|translate}}"
|
||||||
id="passwordInput" name="password" ng-model="pass.password">
|
id="passwordInput" name="password" ng-model="password">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="small-6 columns">
|
<div class="small-6 columns">
|
||||||
<button class="round small-6 columns outline dark-gray expand" ng-click="pass.close(index.askPassword.callback)" translate>
|
<button
|
||||||
|
class="round small-6 columns outline dark-gray expand"
|
||||||
|
ng-click="pass.close(index.askPassword.callback)"
|
||||||
|
ng-disabled="pass.loading" translate>
|
||||||
CANCEL
|
CANCEL
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-6 columns">
|
<div class="small-6 columns">
|
||||||
<button class="round expand" ng-click="pass.set(index.askPassword.isSetup, index.askPassword.callback)" ng-disabled="!pass.password"
|
<button class="round expand"
|
||||||
|
ng-click="pass.set(index.askPassword.isSetup, index.askPassword.callback)"
|
||||||
|
ng-disabled="!password || pass.loading"
|
||||||
ng-style="{'background-color':index.backgroundColor}">
|
ng-style="{'background-color':index.backgroundColor}">
|
||||||
<span ng-if="index.askPassword.isSetup" translate>SET</span>
|
<span ng-if="index.askPassword.isSetup" translate>SET</span>
|
||||||
<span ng-if="!index.askPassword.isSetup">OK</span>
|
<span ng-if="!index.askPassword.isSetup">OK</span>
|
||||||
|
|
|
@ -3,42 +3,41 @@
|
||||||
angular.module('copayApp.controllers').controller('passwordController',
|
angular.module('copayApp.controllers').controller('passwordController',
|
||||||
function($rootScope, $scope, $timeout, profileService, notification, go, gettext) {
|
function($rootScope, $scope, $timeout, profileService, notification, go, gettext) {
|
||||||
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
var pass1;
|
var pass1;
|
||||||
|
|
||||||
self.isVerification = false;
|
this.isVerification = false;
|
||||||
|
|
||||||
document.getElementById("passwordInput").focus();
|
document.getElementById("passwordInput").focus();
|
||||||
|
|
||||||
self.close = function(cb) {
|
this.close = function(cb) {
|
||||||
return cb('No password given');
|
return cb('No password given');
|
||||||
};
|
};
|
||||||
|
|
||||||
self.set = function(isSetup, cb) {
|
this.set = function(isSetup, cb) {
|
||||||
self.error = false;
|
this.loading = true;
|
||||||
|
this.error = false;
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
$timeout(function() {
|
||||||
if (isSetup && !self.isVerification) {
|
if (isSetup && !self.isVerification) {
|
||||||
|
self.loading = false;
|
||||||
document.getElementById("passwordInput").focus();
|
document.getElementById("passwordInput").focus();
|
||||||
self.isVerification = true;
|
self.isVerification = true;
|
||||||
pass1 = self.password;
|
pass1 = $scope.password;
|
||||||
self.password = null;
|
$scope.password = null;
|
||||||
$timeout(function() {
|
|
||||||
$rootScope.$apply();
|
|
||||||
})
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isSetup) {
|
if (isSetup && pass1 != $scope.password) {
|
||||||
if (pass1 != self.password) {
|
self.loading = false;
|
||||||
self.error = gettext('Passwords do not match');
|
self.error = gettext('Passwords do not match');
|
||||||
self.isVerification = false;
|
self.isVerification = false;
|
||||||
self.password = null;
|
$scope.password = null;
|
||||||
pass1 = null;
|
pass1 = null;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
return cb(null, $scope.password);
|
||||||
return cb(null, self.password);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
Loading…
Reference in New Issue