Archived
Refactorization and add metrics system.
This commit is contained in:
@@ -46,8 +46,16 @@ public class AccountController {
|
||||
|
||||
@JsonView(View.UserDTO.class)
|
||||
@PostMapping("/login")
|
||||
public User login(@RequestBody final User pUser) throws BadCredentialsException {
|
||||
return accountService.authenticate(pUser);
|
||||
public User login(@RequestBody final User pUser, HttpServletResponse pResponse) throws BadCredentialsException {
|
||||
User result = null;
|
||||
|
||||
try {
|
||||
result = accountService.authenticate(pUser);
|
||||
} catch(BadCredentialsException ex) {
|
||||
pResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/logout")
|
||||
|
||||
Reference in New Issue
Block a user