Changeset cc88ec2
- Timestamp:
- 02/09/23 14:57:39 (21 months ago)
- Branches:
- master
- Children:
- 17a2fda
- Parents:
- ff75720
- Location:
- src/main/java/com/example/moviezone
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/config/CustomUsernamePasswordAuthenticationProvider.java
rff75720 rcc88ec2 35 35 36 36 UserDetails userDetails = this.userService.findByUsername(username); 37 String realPassword = userDetails.getPassword();38 if (!Objects.equals(password, realPassword)) {37 // String realPassword = userDetails.getPassword(); 38 if (!Objects.equals(password,userDetails.getPassword())) { 39 39 throw new BadCredentialsException("Password is incorrect!"); 40 40 } -
src/main/java/com/example/moviezone/web/HomeController.java
rff75720 rcc88ec2 5 5 import com.example.moviezone.model.exceptions.PasswordsDoNotMatchException; 6 6 7 import com.example.moviezone.model.exceptions.UserNotFoundException; 7 8 import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom; 8 9 … … 15 16 import org.springframework.web.bind.annotation.*; 16 17 18 import javax.servlet.http.HttpServletRequest; 17 19 import javax.servlet.http.HttpSession; 18 20 import javax.transaction.Transactional; … … 135 137 @PostMapping("/login") 136 138 public String login(@RequestParam String username, 137 @RequestParam String password, Model model, HttpSession session)139 @RequestParam String password, Model model, HttpServletRequest request) 138 140 { 139 141 // User user = null; 140 //try {142 try { 141 143 User user=userService.login(username,password); 142 144 System.out.println(user.getFirst_name()); 143 // session.setAttribute("sessionUser",user);144 // model.addAttribute("user",user);145 request.getSession().setAttribute("user", user); 146 // model.addAttribute("user",user); 145 147 return "redirect:/home"; 146 // 147 //}catch (UserNotFoundException e)148 //{149 //model.addAttribute("hasError", true);150 //model.addAttribute("error", e.getMessage());151 // return "login";152 //}148 149 }catch (UserNotFoundException e) 150 { 151 model.addAttribute("hasError", true); 152 model.addAttribute("error", e.getMessage()); 153 return "/login"; 154 } 153 155 154 156 }
Note:
See TracChangeset
for help on using the changeset viewer.