Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public ResponseEntity<Map<String, Object>> main(@AuthenticationPrincipal UserEnt
MyResponseDTO response = mypageService.getMyPageInfo(userInfo);

return ResponseEntity.ok().body(Map.of("code", 200, "data", response));
} catch (IllegalArgumentException e) {
} catch (IllegalArgumentException | UnsupportedEncodingException e) {
return ResponseEntity.badRequest().body(Map.of("code", 400, "data", e.getMessage()));
} catch (RuntimeException e) {
return ResponseEntity.status(500).body(Map.of("code", 500, "data", "마이페이지 로딩 오류. 잠시 후 다시 시도해주세요."));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
Expand All @@ -53,6 +55,9 @@ public class MypageService {
@Value("${cloud.aws.s3.folder.folderName1}")
private String userImageBucketFolder;

@Value("${cloud.aws.s3.url}")
private String bucketURL;

public Boolean equalPassword(final String email, final String password, final PasswordEncoder encoder) {
final UserEntity user = mypageRepo.findByEmail(email);

Expand Down Expand Up @@ -145,7 +150,7 @@ public void deleteUser(final UserEntity user) {
* @param user 사용자 엔티티
* @return MyResponseDTO
*/
public MyResponseDTO getMyPageInfo(UserEntity user) {
public MyResponseDTO getMyPageInfo(UserEntity user) throws UnsupportedEncodingException {
// 내 정보
MyResponseDTO.MyProfile myProfile = getMyProfile(user);

Expand Down Expand Up @@ -177,12 +182,12 @@ public MyResponseDTO getMyPageInfo(UserEntity user) {
// == Private Methods ==

// 내 정보를 불러오는 메서드
private MyResponseDTO.MyProfile getMyProfile(UserEntity user) {
private MyResponseDTO.MyProfile getMyProfile(UserEntity user) throws UnsupportedEncodingException {
UserEntity userInfo = originalUser(user.getEmail());

return MyResponseDTO.MyProfile.builder()
.userId(userInfo.getId())
.userImage(userInfo.getImage())
.userImage(user.getImage() != null ? bucketURL + URLEncoder.encode(user.getImage(), "UTF-8") : "")
.username(userInfo.getName())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public ResponseEntity<Map<String, Object>> getProject(@AuthenticationPrincipal U
.image(project.getImage() != null ? bucketURL + URLEncoder.encode(project.getImage(), "UTF-8") : "")
.role(teamService.getRole(projectId, userInfo) == null ? null : teamService.getRole(projectId, userInfo).getRole())
.isOnGoing(project.isOnGoing())
.start(project.isStart())
.build();

return ResponseEntity.ok().body(Map.of("code", 200, "data", resDTO));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ public class ProjectDetailResponseDTO {
private String image;
private ProjectRole role;
private boolean isOnGoing;
private boolean start;
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public ResponseEntity<Map<String, Object>> findPassword(@RequestBody AuthNumRequ
}

@PostMapping("/resetPw")
public ResponseEntity<Map<String, Object>> resetPassword(@AuthenticationPrincipal UserEntity userInfo, @RequestBody @Valid ResetPWRequestDTO dto, BindingResult bindingResult) {
public ResponseEntity<Map<String, Object>> resetPassword(@RequestBody @Valid ResetPWRequestDTO dto, BindingResult bindingResult) {
try {
userService.validation(bindingResult, "password");

Expand All @@ -163,7 +163,7 @@ public ResponseEntity<Map<String, Object>> resetPassword(@AuthenticationPrincipa
.password(pwEncoder.encode(dto.getPassword()))
.build();

userService.updatePw(userInfo.getEmail(), user);
userService.updatePw(dto.getEmail(), user);

return ResponseEntity.ok().body(Map.of("code", 200, "data", true));
} catch (IllegalArgumentException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ public class ResetPWRequestDTO {
private String password;

private String confirmPassword;

private String email;
}