diff --git a/config/env/development.js b/config/env/development.js index 9e44c4eb..6678e1ea 100755 --- a/config/env/development.js +++ b/config/env/development.js @@ -21,6 +21,9 @@ module.exports = { app: { title: 'TellForm' }, + sessionCookie: { + domain: process.env.BASE_URL || 'http://localhost:3000' + }, facebook: { clientID: process.env.FACEBOOK_ID || 'APP_ID', clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET', diff --git a/public/application.js b/public/application.js index fac86e70..516a868e 100755 --- a/public/application.js +++ b/public/application.js @@ -39,7 +39,8 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope' if(toState.name === 'home' || toState.name === 'signin' || toState.name === 'resendVerifyEmail' || toState.name === 'verify' || toState.name === 'signup' || toState.name === 'signup-success'){ if(Auth.isAuthenticated()){ event.preventDefault(); // stop current execution - $state.go('listForms'); // go to listForms page + console.log('go to forms'); + $state.go('listForms'); // go to listForms page } } //Redirect to 'home' route if user is not authenticated @@ -66,12 +67,14 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope' if(user){ authenticator = new Authorizer(user); - console.log('access denied: '+!authenticator.canAccess(permissions)); - - if( (permissions !== null) && !authenticator.canAccess(permissions) ){ - event.preventDefault(); - console.log('access denied'); - $state.go('access_denied'); + //console.log('access denied: '+!authenticator.canAccess(permissions)); + //console.log(permissions); + if( (permissions != null) ){ + if( !authenticator.canAccess(permissions) ){ + event.preventDefault(); + console.log('access denied'); + $state.go('access_denied'); + } } } }); @@ -84,4 +87,4 @@ angular.element(document).ready(function() { //Then init the app angular.bootstrap(document, [ApplicationConfiguration.applicationModuleName]); -}); \ No newline at end of file +});