Reputation: 133
I am using a jhipster Gateway project. I have created custom screens and when i tried to logout and then clicked the browser back button, its navigating to the previous screens. How to prevent this ?
One of my state.js file:
(function() { 'use strict';
angular
.module('wheelsoncloudgatewayApp')
.config(stateConfig);
stateConfig.$inject = ['$stateProvider'];
function stateConfig($stateProvider) {
$stateProvider.state('tenantRegistration', {
parent: 'dashboard',
url: '/tenantRegistration',
data: {
authorities: []
},
views: {
'content@': {
templateUrl: 'app/dashboard/tenantRegistration/tenantRegistration.html',
controller: 'TenantRegistrationController',
controllerAs: 'vm'
}
}
});
$stateProvider.state('tenantView', {
parent: 'dashboard',
url: '/tenantDetails',
data: {
authorities: []
},
views: {
'content@': {
templateUrl: 'app/dashboard/tenantRegistration/tenant.html',
controller: 'TenantRegistrationController',
controllerAs: 'vm'
}
}
});
$stateProvider.state('tenantUserView', {
parent: 'dashboard',
url: '/userDetails/:id',
data: {
authorities: []
},
views: {
'content@': {
templateUrl: 'app/dashboard/tenantRegistration/userDetail.html',
controller: 'TenantRegistrationController',
controllerAs: 'vm'
}
}
});
}
})();
Upvotes: 1
Views: 579
Reputation: 16294
Protect your states by setting authorities: ['ROLE_USER']
it will prevent anonymous user (after logout) to reach tenantView state. See doc at http://www.jhipster.tech/using-angularjs/
Upvotes: 1