@RequestMapping(value = {"/home", "/"})
public String home(User user, @RequestParam(value = "exception", defaultValue = "") String exception,
@RequestParam(value = "region", defaultValue = "") String region, ModelMap model,
HttpServletResponse response, HttpServletRequest request) {
try {
Role role;
try {
recordReferrer(region);
// set local language
setLanguage(getCurrentUser().getUserLanguage(), response, request);
setLoginPageDate(model);
role = user.getRole();
} catch (AuthenticationCredentialsNotFoundException e) {
return "login";
}
setPanelEntries(model);
model.addAttribute("handlers", scriptHandlerFactory.getVisibleHandlers());
if (StringUtils.isNotBlank(exception)) {
model.addAttribute("exception", exception);
}
if (role == Role.ADMIN || role == Role.SUPER_USER || role == Role.USER) {
return "index";
} else {
LOG.info("Invalid user role:{}", role.getFullName());
return "login";
}
} catch (Exception e) {
// Make the home reliable...
model.addAttribute("exception", e.getMessage());