add pin fixes

This commit is contained in:
Matias Alejo Garcia 2014-12-11 03:41:28 -03:00
parent 05b6cfa56f
commit a34171e8cd
3 changed files with 26 additions and 21 deletions

View File

@ -45,14 +45,18 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
preconditions.checkState(_credentials && _credentials.email); preconditions.checkState(_credentials && _credentials.email);
$scope.loading = true; $scope.loading = true;
pinService.save(pin, _credentials.email, _credentials.password, function(err) { $timeout(function() {
_credentials.password = ''; $rootScope.$digest();
_credentials = null;
$scope.askForPin = 0; pinService.save(pin, _credentials.email, _credentials.password, function(err) {
$rootScope.hasPin = true; _credentials.password = '';
$scope.loading = null; _credentials = null;
$scope.createDefaultWallet(); $scope.askForPin = 0;
}); $rootScope.hasPin = true;
$scope.loading = null;
$scope.createDefaultWallet();
});
}, 1);
}; };
@ -163,7 +167,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
return; return;
} }
$scope.saveSettings(function(err) { $scope.saveSettings(function(err) {
preconditions.checkState(!err,err); preconditions.checkState(!err, err);
$scope._doCreateProfile($scope.userOrEmail, form.password.$modelValue, function(err) { $scope._doCreateProfile($scope.userOrEmail, form.password.$modelValue, function(err) {
$timeout(function() { $timeout(function() {

View File

@ -61,18 +61,20 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
$scope.error = 'Please enter the required fields'; $scope.error = 'Please enter the required fields';
return; return;
} }
$scope.loading = true;
$rootScope.starting = true; $rootScope.starting = true;
var credentials = pinService.get(pin, function(err, credentials) { $timeout(function() {
if (err || !credentials) { $rootScope.$digest();
$rootScope.starting = false; var credentials = pinService.get(pin, function(err, credentials) {
$scope.loading = null; if (err || !credentials) {
$scope.error = 'Wrong PIN'; $rootScope.starting = false;
return; $scope.loading = null;
} $scope.error = 'Wrong PIN';
$scope.open(credentials.email, credentials.password); return;
}); }
$scope.open(credentials.email, credentials.password);
});
},1);
}; };

View File

@ -109,8 +109,7 @@
</div> </div>
<div class="large-6 medium-6 small-6 columns text-right"> <div class="large-6 medium-6 small-6 columns text-right">
<button translate type="submit" class="button primary radius expand m0" <button translate type="submit" class="button primary radius expand m0"
ng-disabled="pinForm.$invalid || error || loading"> ng-disabled="pinForm.$invalid || error">
<i class="fi-bitcoin-circle icon-rotate spinner" ng-show="loading"></i>
Sign in Sign in
</button> </button>
</div> </div>