Skip to content

Commit

Permalink
Fixes #69
Browse files Browse the repository at this point in the history
  • Loading branch information
kavi87 committed Apr 14, 2016
1 parent d49196c commit dadeddd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions modules/security.js
Original file line number Diff line number Diff line change
Expand Up @@ -1076,28 +1076,28 @@ define([

w20CoreSecurity.run(['AuthenticationService', 'ApplicationService', 'EventService', 'StateService', '$location',
function (authenticationService, applicationService, eventService, stateService, $location) {

function inBrowserSession (state) {
function inBrowserSession(state) {
var sessionState = stateService.state('session', 'isActive', false, true);
return typeof state !== 'boolean' ? sessionState.value() : sessionState.value(state);
}

var notInBrowserSession = !inBrowserSession();

if (typeof config.redirectAfterLogin === 'string') {
eventService.on('w20.security.authenticated', function () {
eventService.on('w20.security.authenticated', function () {
if (typeof config.redirectAfterLogin === 'string') {
if (notInBrowserSession) {
$location.path(config.redirectAfterLogin);
inBrowserSession(true);
}
});
}
}
});

if (typeof config.redirectAfterLogout === 'string') {
eventService.on('w20.security.deauthenticated', function () {
eventService.on('w20.security.deauthenticated', function () {
inBrowserSession(false);
if (typeof config.redirectAfterLogout === 'string') {
$location.path(config.redirectAfterLogout);
});
}
}
});

_.each(allRealms, function (definition, realm) {
var providerFactory = allProviders[definition.provider];
Expand Down

0 comments on commit dadeddd

Please sign in to comment.