示例#1
0
 @RequestMapping(value = "/main_page")
 public String mainPage(Model model) {
   if (!userService.isAuth()) {
     model.addAttribute("message", "Access denied.\n");
     return "login";
   }
   return "main_page";
 }
示例#2
0
 @RequestMapping(value = "/login", method = RequestMethod.POST)
 public String processLoginForm(Model model, @ModelAttribute("loginForm") LoginForm loginForm) {
   if (formProcessor.checkLoginForm(model, loginForm)) {
     userService.setAuth();
     return "redirect:/main_page";
   } else {
     return "login";
   }
 }
示例#3
0
 @RequestMapping(value = "/logout")
 public String logout(Model model) {
   if (userService.isAuth()) userService.unsetAuth();
   return "redirect:/";
 }