- public String login(Map<String, Object> model, final HttpServletResponse response) {
- response.setHeader("X-Page-Location", "/login");
- return "login";
- }
+ public String login(Model model, final HttpServletRequest request,
+ final HttpServletResponse response) {
+ // response.setHeader("X-Page-Location", "/login");
+ IUserManager userManager = (IUserManager) ServiceHelper
+ .getGlobalInstance(IUserManager.class, this);
+ if (userManager == null) {
+ return "User Manager is not available";
+ }
+
+ String username = request.getUserPrincipal().getName();
+
+ model.addAttribute("username", username);
+ model.addAttribute("role", userManager.getUserLevel(username)
+ .toNumber());
+ return "forward:" + "/";
+ }