Пример #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:/";
 }