From a34171e8cdc3577a793534b205eb1b132af0cd21 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 11 Dec 2014 03:41:28 -0300 Subject: [PATCH] add pin fixes --- js/controllers/createProfile.js | 22 +++++++++++++--------- js/controllers/home.js | 22 ++++++++++++---------- views/home.html | 3 +-- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/js/controllers/createProfile.js b/js/controllers/createProfile.js index aaf1caf14..aec2acdbd 100644 --- a/js/controllers/createProfile.js +++ b/js/controllers/createProfile.js @@ -45,14 +45,18 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun preconditions.checkState(_credentials && _credentials.email); $scope.loading = true; - pinService.save(pin, _credentials.email, _credentials.password, function(err) { - _credentials.password = ''; - _credentials = null; - $scope.askForPin = 0; - $rootScope.hasPin = true; - $scope.loading = null; - $scope.createDefaultWallet(); - }); + $timeout(function() { + $rootScope.$digest(); + + pinService.save(pin, _credentials.email, _credentials.password, function(err) { + _credentials.password = ''; + _credentials = null; + $scope.askForPin = 0; + $rootScope.hasPin = true; + $scope.loading = null; + $scope.createDefaultWallet(); + }); + }, 1); }; @@ -163,7 +167,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun return; } $scope.saveSettings(function(err) { - preconditions.checkState(!err,err); + preconditions.checkState(!err, err); $scope._doCreateProfile($scope.userOrEmail, form.password.$modelValue, function(err) { $timeout(function() { diff --git a/js/controllers/home.js b/js/controllers/home.js index d9fd246f4..4f2ec5522 100644 --- a/js/controllers/home.js +++ b/js/controllers/home.js @@ -61,18 +61,20 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc $scope.error = 'Please enter the required fields'; return; } - $scope.loading = true; $rootScope.starting = true; - var credentials = pinService.get(pin, function(err, credentials) { - if (err || !credentials) { - $rootScope.starting = false; - $scope.loading = null; - $scope.error = 'Wrong PIN'; - return; - } - $scope.open(credentials.email, credentials.password); - }); + $timeout(function() { + $rootScope.$digest(); + var credentials = pinService.get(pin, function(err, credentials) { + if (err || !credentials) { + $rootScope.starting = false; + $scope.loading = null; + $scope.error = 'Wrong PIN'; + return; + } + $scope.open(credentials.email, credentials.password); + }); + },1); }; diff --git a/views/home.html b/views/home.html index 4f92f65f4..1359e6a0e 100644 --- a/views/home.html +++ b/views/home.html @@ -109,8 +109,7 @@