Skip to content

Commit

Permalink
Merge pull request #45 from Team-KeepGoing/feature/user
Browse files Browse the repository at this point in the history
Fix :: fix jwt response return value
  • Loading branch information
miraexhoi authored Jun 12, 2024
2 parents 9b0a837 + 9b4d58e commit 9a9ed0e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ public class JwtResponse {
private String token;
private Long id;
private String email;
private String password;
private String name;
private boolean teacher;

public static JwtResponse setJwtResponse(String token, Long id, String email, String password, boolean teacher) {
public static JwtResponse setJwtResponse(String token, Long id, String email, String name, boolean teacher) {
JwtResponse jwtResponse = new JwtResponse();
jwtResponse.token = token;
jwtResponse.id = id;
jwtResponse.email = email;
jwtResponse.password = password;
jwtResponse.name = name;
jwtResponse.teacher = teacher;
return jwtResponse;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public String getEmail() {
return email;
}

public String getName() {
return name;
}

@Override
public String getPassword() {
return password;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public JwtResponse authenticateAndGenerateJWT(String email, String password) {
String jwt = jwtUtils.generateJwtToken(authentication);
UserDetailsImpl userDetails = (UserDetailsImpl) authentication.getPrincipal();

return JwtResponse.setJwtResponse(jwt, userDetails.getId(), userDetails.getEmail(), userDetails.getPassword(), userDetails.isTeacher());
return JwtResponse.setJwtResponse(jwt, userDetails.getId(), userDetails.getEmail(), userDetails.getName(), userDetails.isTeacher());
}

private List<DeviceResponseDto> getBorrowedDevicesForUser(User user) {
Expand Down

0 comments on commit 9a9ed0e

Please sign in to comment.