How do I change the landing page when logging into the admin?
The AdminLoginController
handles the redirect upon a successful login. The method loginSuccess
(url "/loginSuccess" or "/") is the method called. Currently it redirects to the first available admin section which will be the first section that is retrieved by the code.
To change it, extend the AdminLoginController
and override the loginSuccess(...)
method to change the behavior.
@RequestMapping(value = {"/", "/loginSuccess"}, method = RequestMethod.GET) public String loginSuccess(HttpServletRequest request, HttpServletResponse response, Model model) { AdminMenu adminMenu = adminNavigationService.buildMenu(getPersistentAdminUser()); if (!adminMenu.getAdminModules().isEmpty()) { AdminModule first = adminMenu.getAdminModules().get(0); List<AdminSection> sections = first.getSections(); if (!sections.isEmpty()) { AdminSection adminSection = sections.get(0); return "redirect:" + adminSection.getUrl(); } } return "noAccess"; }