Changeset d7f5da9 for src/main/java/com/example/moviezone/web
- Timestamp:
- 02/07/23 13:48:25 (23 months ago)
- Branches:
- master
- Children:
- fc448f5
- Parents:
- f7b0906
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/web/HomeController.java
rf7b0906 rd7f5da9 77 77 78 78 @PostMapping("/login") 79 public String login(@RequestParam String username,@RequestParam String password,Model model, HttpSession session) 80 { 81 User user = null; 82 try { 83 user=userService.login(username,password); 84 session.setAttribute("sessionUser",user); 85 model.addAttribute("user",user); 79 public String login(@RequestParam String username, 80 @RequestParam String password,Model model, HttpSession session) 81 { 82 // User user = null; 83 // try { 84 User user=userService.login(username,password); 85 System.out.println(user.getFirst_name()); 86 // session.setAttribute("sessionUser",user); 87 // model.addAttribute("user",user); 86 88 return "redirect:/home"; 87 88 }catch (UserNotFoundException e)89 {90 model.addAttribute("hasError", true);91 model.addAttribute("error", e.getMessage());92 return "login";93 }89 // 90 // }catch (UserNotFoundException e) 91 // { 92 // model.addAttribute("hasError", true); 93 // model.addAttribute("error", e.getMessage()); 94 // return "login"; 95 // } 94 96 95 97 } … … 106 108 { 107 109 try { 108 User user=userService.register(first_name,last_name,username,email,number,password,repeatedPassword,role);110 userService.register(first_name,last_name,username,email,number,password,role); 109 111 return "redirect:/login"; 110 112 }catch (PasswordsDoNotMatchException exception)
Note:
See TracChangeset
for help on using the changeset viewer.