Skip to content

Commit

Permalink
Merge pull request #82 from wooyeon0626/feature/join
Browse files Browse the repository at this point in the history
[CHORE] 회원가입 과정 중, UserController 및 EmailAuthService log 추가
  • Loading branch information
easyoungcode authored Feb 7, 2024
2 parents f04c89f + b64add5 commit 1359d4f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@ public SseEmitter sendEmailVerify(@RequestBody EmailRequestDto emailRequestDto)
userEmitters.put(emailRequestDto.getEmail(), emitter);

EmailResponseDto emailResponseDto = emailAuthService.sendEmail(emailRequestDto);
log.info("userEmitter: " + userEmitters);
log.debug("userEmitter: {}", userEmitters);

// SSE 연결 여부 메시지 전송
try {
emitter.send(SseEmitter.event().name("INIT").data("SSE Connected"));
emitter.send(SseEmitter.event().data(emailResponseDto));
log.debug("[Controller] emailResponseDto: {}", emailResponseDto);
} catch (IOException e) {
emitter.completeWithError(e);
}
log.info("SSE MSG : " + emitter);
log.debug("SSE MSG : " + emitter);

return emitter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public EmailResponseDto sendEmail(EmailRequestDto emailRequestDto) throws Messag
// 이메일 중복 확인 로직 추가
if (validateDuplicated(emailRequestDto.getEmail())) {

log.info("certification: " + emailAuthRepository.findEmailAuthByEmail(emailRequestDto.getEmail()).isCertification());
log.debug(emailRequestDto.getEmail()+" certification: {}", emailAuthRepository.findEmailAuthByEmail(emailRequestDto.getEmail()).isCertification());

EmailResponseDto emailResponseDto = EmailResponseDto.builder()
.statusCode(HttpStatus.SC_OK) // 오류코드 대신 200 부탁함
Expand All @@ -58,12 +58,11 @@ public EmailResponseDto sendEmail(EmailRequestDto emailRequestDto) throws Messag

if (emailAuthRepository.findEmailAuthByEmail(emailRequestDto.getEmail()).isCertification()) {
emailResponseDto.updateStatusName("completed");
return emailResponseDto;
} else {
emailResponseDto.updateStatusName("duplicated");
return emailResponseDto;
}

log.debug("emailResponseDto 이미 있음 : {}", emailResponseDto);
return emailResponseDto;
} else {
// 이메일 인증 링크 발송
sendEmailVerification(emailRequestDto);
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/wooyeon/yeon/user/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public PasswordEncryptResponseDto decodeEncrypt(PasswordEncryptRequestDto passwo
// 4. IV, SessionKey로 암호화된 비밀번호 복호화
// AES Key 로 비밀번호 복호화해서 원문 받아오기
String decodedPassword = aesUtil.decrypt(passwordEncryptRequestDto.getEncryptedPassword(), decodedKey, ivBytes);
log.info("AES로 복호화한 원문 : {}", decodedPassword);
log.debug("AES로 복호화한 원문 : {}", decodedPassword);

// 비밀번호 + salt를 SHA256으로 암호화
// String salt = createSalt();
Expand All @@ -93,6 +93,7 @@ public PasswordEncryptResponseDto decodeEncrypt(PasswordEncryptRequestDto passwo

// passwordEncoder로 비밀번호 암호화 (2024.02.06 로그인과 암호화 방식 맞춤 수정)
String finalPassword = passwordEncoder.encode(decodedPassword);
log.debug("finalPassword : {}", finalPassword);

// User 테이블에 저장
User user = User.builder()
Expand All @@ -103,6 +104,9 @@ public PasswordEncryptResponseDto decodeEncrypt(PasswordEncryptRequestDto passwo
.build();
userRepository.save(user);

Long id = user.getUserId();
// userRoles 코드 추가할 부분

// ResponseDto 구성
PasswordEncryptResponseDto passwordEncryptResponseDto = PasswordEncryptResponseDto.builder()
.statusCode(HttpStatus.SC_OK)
Expand Down

0 comments on commit 1359d4f

Please sign in to comment.