From dadeddd66196df1285232e8500db59d94f9dcc64 Mon Sep 17 00:00:00 2001 From: kavi87 Date: Thu, 14 Apr 2016 16:46:25 +0200 Subject: [PATCH] Fixes #69 --- modules/security.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/security.js b/modules/security.js index b0e9584..a2d8d1c 100644 --- a/modules/security.js +++ b/modules/security.js @@ -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];