Fix link account
This commit is contained in:
parent
fcae682954
commit
4ec340640e
4 changed files with 22 additions and 45 deletions
|
|
@ -108,7 +108,11 @@ angular.module('copayApp.controllers').controller('glideraController',
|
|||
$scope.network = glideraService.getNetwork();
|
||||
$scope.showOauthForm = false;
|
||||
$scope.account = {};
|
||||
init();
|
||||
if (data.stateParams && data.stateParams.code) {
|
||||
$scope.submitOauthCode(data.stateParams.code);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.controllers').controller('glideraUriController',
|
||||
function($scope, $log, $stateParams, $timeout, glideraService, storageService, $state, ongoingProcess, popupService, gettextCatalog) {
|
||||
|
||||
var submitOauthCode = function(code) {
|
||||
$log.debug('Glidera Oauth Code:' + code);
|
||||
$scope.network = glideraService.getEnvironment();
|
||||
ongoingProcess.set('connectingGlidera', true);
|
||||
$timeout(function() {
|
||||
glideraService.getToken(code, function(err, data) {
|
||||
ongoingProcess.set('connectingGlidera', false);
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
} else if (data && data.access_token) {
|
||||
storageService.setGlideraToken($scope.network, data.access_token, function() {
|
||||
$timeout(function() {
|
||||
$state.go('tabs.buyandsell.glidera');
|
||||
$scope.$apply();
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data){
|
||||
if ($stateParams.url) {
|
||||
var match = $stateParams.url.match(/code=(.+)/);
|
||||
if (match && match[1]) {
|
||||
submitOauthCode(match[1]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
$log.error('Bad state: ' + JSON.stringify($stateParams));
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue