From b64add56a8aa69a05edfe2e116484fa44b801c59 Mon Sep 17 00:00:00 2001 From: easyoungcode Date: Wed, 7 Feb 2024 23:00:01 +0900 Subject: [PATCH] =?UTF-8?q?[CHORE]=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85?= =?UTF-8?q?=20=EA=B3=BC=EC=A0=95=20=EC=A4=91,=20EmailAuthService=20log=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wooyeon/yeon/user/controller/UserController.java | 5 +++-- .../com/wooyeon/yeon/user/service/EmailAuthService.java | 7 +++---- .../java/com/wooyeon/yeon/user/service/UserService.java | 6 +++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/wooyeon/yeon/user/controller/UserController.java b/src/main/java/com/wooyeon/yeon/user/controller/UserController.java index a52ad6e..519724b 100644 --- a/src/main/java/com/wooyeon/yeon/user/controller/UserController.java +++ b/src/main/java/com/wooyeon/yeon/user/controller/UserController.java @@ -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; } diff --git a/src/main/java/com/wooyeon/yeon/user/service/EmailAuthService.java b/src/main/java/com/wooyeon/yeon/user/service/EmailAuthService.java index 4059283..32e55a2 100644 --- a/src/main/java/com/wooyeon/yeon/user/service/EmailAuthService.java +++ b/src/main/java/com/wooyeon/yeon/user/service/EmailAuthService.java @@ -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 부탁함 @@ -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); diff --git a/src/main/java/com/wooyeon/yeon/user/service/UserService.java b/src/main/java/com/wooyeon/yeon/user/service/UserService.java index 5bc9b34..ce30299 100644 --- a/src/main/java/com/wooyeon/yeon/user/service/UserService.java +++ b/src/main/java/com/wooyeon/yeon/user/service/UserService.java @@ -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(); @@ -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() @@ -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)