Skip to content

Commit

Permalink
pass isLinking param to oauth.authenticate() to prevent redirect afte…
Browse files Browse the repository at this point in the history
…r authentication (linking)
  • Loading branch information
sahat committed Sep 16, 2014
1 parent 62e560c commit eb6ba61
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
10 changes: 3 additions & 7 deletions examples/client/vendor/satellizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@
function($q, $window, $location, config) {
var shared = {};

shared.saveToken = function(response, deferred) {
shared.saveToken = function(response, deferred, isLinking) {
var token = response.data[config.tokenName];
var namespace = [config.tokenPrefix, config.tokenName].join('_');
$window.localStorage[namespace] = token;

if (config.loginRedirect) {
if (config.loginRedirect && !isLinking) {
$location.path(config.loginRedirect);
}

Expand Down Expand Up @@ -252,11 +252,7 @@

provider.open(config.providers[name])
.then(function(response) {
if (isLinking) {
deferred.resolve(response);
} else {
shared.saveToken(response, deferred);
}
shared.saveToken(response, deferred, isLinking);
})
.catch(function(response) {
deferred.reject(response);
Expand Down
10 changes: 3 additions & 7 deletions satellizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@
function($q, $window, $location, config) {
var shared = {};

shared.saveToken = function(response, deferred) {
shared.saveToken = function(response, deferred, isLinking) {
var token = response.data[config.tokenName];
var namespace = [config.tokenPrefix, config.tokenName].join('_');
$window.localStorage[namespace] = token;

if (config.loginRedirect) {
if (config.loginRedirect && !isLinking) {
$location.path(config.loginRedirect);
}

Expand Down Expand Up @@ -252,11 +252,7 @@

provider.open(config.providers[name])
.then(function(response) {
if (isLinking) {
deferred.resolve(response);
} else {
shared.saveToken(response, deferred);
}
shared.saveToken(response, deferred, isLinking);
})
.catch(function(response) {
deferred.reject(response);
Expand Down
2 changes: 1 addition & 1 deletion satellizer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eb6ba61

Please sign in to comment.