added debugging output

This commit is contained in:
David Baldwynn 2015-11-06 19:53:03 -08:00
parent 393277e67a
commit af3df34e84
2 changed files with 3 additions and 1 deletions

View file

@ -33,6 +33,7 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope'
// add previous state property
$rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState) {
$state.previous = fromState;
console.log('toState: '+toState.name);
//Redirect to listForms if user is authenticated
if(toState.name === 'home' || toState.name === 'signin' || toState.name === 'resendVerifyEmail' || toState.name === 'verify' || toState.name === 'signup' || toState.name === 'signup-success'){
@ -43,6 +44,7 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope'
}
//Redirect to 'home' route if user is not authenticated
else if(toState.name !== 'access_denied' && !Auth.isAuthenticated() && toState.name !== 'submitForm'){
console.log('go to home');
event.preventDefault(); // stop current execution
$state.go('home'); // go to listForms page
}

View file

@ -8,7 +8,7 @@ angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScop
if(!$scope.myform.isLive){
// Show navbar if form is not public AND user IS loggedin
if($scope.authentication.isAuthenticated()){
if($scope.authentication.isAuthenticated() && $scope.currentUser()._id === $scpoe.myform.admin._id){
$scope.hideNav = $rootScope.hideNav = false;
}
// Redirect if form is not public user IS NOT loggedin