fix coinbase

This commit is contained in:
Matias Alejo Garcia 2016-06-11 18:40:29 -03:00
commit d42e9f6896
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
2 changed files with 47 additions and 43 deletions

View file

@ -16,8 +16,7 @@ angular.module('copayApp.controllers').controller('coinbaseUriController',
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}, 100); }, 100);
} } else if (data && data.access_token && data.refresh_token) {
else if (data && data.access_token && data.refresh_token) {
storageService.setCoinbaseToken(network, data.access_token, function() { storageService.setCoinbaseToken(network, data.access_token, function() {
storageService.setCoinbaseRefreshToken(network, data.refresh_token, function() { storageService.setCoinbaseRefreshToken(network, data.refresh_token, function() {
$scope.$emit('Local/CoinbaseUpdated', data.access_token); $scope.$emit('Local/CoinbaseUpdated', data.access_token);
@ -33,8 +32,13 @@ angular.module('copayApp.controllers').controller('coinbaseUriController',
}; };
this.checkCode = function() { this.checkCode = function() {
this.code = $stateParams.code; if ($stateParams.url) {
this.submitOauthCode(this.code); var match = $stateParams.url.match(/code=(.+)&/);
}; if (match && match[1]) {
this.code = match[1];
return this.submitOauthCode(this.code);
}
}
$log.error('Bad state: ' + JSON.stringify($stateParams));
}
}); });