Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat-be: 이메일 인증 기능 구현 #848

Merged
merged 12 commits into from
Oct 22, 2024
Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 19, 2024

Original issue description

목적

이메일 인증 기능 구현합니다.

작업 세부사항

  • 이메일 인증 번호 전송 구현
  • 이메일 인증 번호 인증 구현
  • API 문서화
  • Redis TTL 10분 설정
  • 인증번호 총 6자리로 생성

아래의 별표줄 밑에 요구사항 ID만 작성해주세요. Prefix 금지!


EMAIL_VALID_01

closes #846

@github-actions github-actions bot added backend 백엔드 feature 새로운 기능 labels Oct 19, 2024
@github-actions github-actions bot added this to the 스프린트 6.0 milestone Oct 19, 2024
@Chocochip101 Chocochip101 marked this pull request as ready for review October 19, 2024 17:24
Copy link
Contributor Author

1729358679.500039

Copy link
Contributor Author

1729358681.903989

Copy link
Contributor Author

1729358683.242319

Copy link
Contributor Author

📌 Test Coverage Report

Overall Project 78.69% -0.93%
Files changed 56.7%

File Coverage
VerifyCodeRequest.java 100% 🍏
EmailRequest.java 100% 🍏
SendVerificationCodeRequest.java 100% 🍏
VerificationCodeUtil.java 100% 🍏
WebMvcConfig.java 100% 🍏
VerificationCodeMismatchException.java 100% 🍏
VerificationCodeNotFoundException.java 100% 🍏
EmailFacade.java 83.77% -11.04%
EmailService.java 63.29% -20.77%
EmailRedisClient.java 58.33% -41.67%
EmailController.java 48.15% -51.85%

Copy link
Member

@cutehumanS2 cutehumanS2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고 많으셨습니다. 👍
코멘트 하나 남겼으니 확인 부탁드려요.

}

private void verify(String storedVerificationCode, String inputVerificationCode) {
if (storedVerificationCode == null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

옵셔널을 활용할 수 없을까요? ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verify 로직을 VerificationCodeUtil로 옮기고 나니, 매개변수에 Optional을 달고 다녀야하는 문제점 때문에 적용하지 않았습니다.

Copy link
Contributor

@HyungHoKim00 HyungHoKim00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dev 환경에 redis docker 설정도 추가해주세요~

  • 서비스 테스트도 추가해주세용


public void saveVerificationCode(String email, String verificationCode) {
redisTemplate.opsForValue()
.set(REDIS_PREFIX + email, verificationCode, VERIFICATION_CODE_EXPIRATION, TimeUnit.MINUTES);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10분인 이유가 있나요? 단순 궁금증입니다.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10분이 인증하기에 적당한 시간이여서 설정했습니다. 더 좋은 시간이 있다면 반영하겠습니다~

verify(storedVerificationCode, inputVerificationCode);
}

private void verify(String storedVerificationCode, String inputVerificationCode) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 메서드를 VerificationCodeUtil에 넣는건 어떠신가요?

@Async
public void sendVerificationCode(String to, String verificationCode) {
try {
String subject = "인증 코드 안내";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제목에 [크루루] 이런거 붙어있으면 좋겠어용


@DisplayName("저장된 인증 코드가 없으면 예외가 발생한다.")
@Test
void verifyCode_verificationCodeNotFoundException() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

성공 테스트도 있으면 좋을 것 같아요.

@Chocochip101
Copy link
Member

@cutehumanS2 @HyungHoKim00

변경사항

  1. dev 서버에서 실행되
  2. 는 것을 확인했습니다.

image

  1. 이메일 인증 페이지의 템플릿을 적용했습니다.
image
  1. EmailRedisClient의 MockBean 적용

CI/CD 과정에서 테스트를 실행하면 레디스 서버가 없기 때문에 테스트가 실패하여 CI/CD가 불가능합니다. 따라서 MockBean으로 변경했습니다.

리뷰

서비스 테스트도 추가해주세용

EmailService에서 저장로직 없이 이메일만 보내는 로직만 존재하기에 테스트를 추가하지 않았습니다.

Copy link
Contributor

@HyungHoKim00 HyungHoKim00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Chocochip101 Chocochip101 merged commit 760dd30 into be/develop Oct 22, 2024
20 checks passed
@Chocochip101 Chocochip101 deleted the be-846-EMAIL_VALID_01 branch October 22, 2024 00:22
Dobby-Kim pushed a commit that referenced this pull request Oct 23, 2024
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kwoun Ki Ho <fingercut3822@gmail.com>
Dobby-Kim pushed a commit that referenced this pull request Oct 23, 2024
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kwoun Ki Ho <fingercut3822@gmail.com>
Dobby-Kim pushed a commit that referenced this pull request Oct 23, 2024
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kwoun Ki Ho <fingercut3822@gmail.com>
@Dobby-Kim Dobby-Kim mentioned this pull request Oct 23, 2024
Dobby-Kim added a commit that referenced this pull request Oct 23, 2024
fix-be: applicantCard 조회 시 평가 점수와 갯수가 모든 프로세스에 대해 나오는 버그 수정 (#902)
fix-be: 이메일 인증 시 이미 가입된 이메일은 예외를 던지도록 변경 (#906)
feat-be: RTR 방식 Redis로 변경 (#889)
feat-be: 이메일 전송 템플릿 적용 (#897)
feat-be: 이메일 인증 후, 회원가입 이메일의 인증 여부 확인 (#882)
refactor-be: 식별자에 Tsid 적용 (#856)
feat-be: 이메일 전송 로직 중 지원자 일괄 조회 로직 구현 (#869)
fix-be: github action의 Redis 환경 변수 추가 (#871)
feat-be: 이메일 인증 기능 구현 (#848)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend 백엔드 feature 새로운 기능
Projects
Status: 완료
Development

Successfully merging this pull request may close these issues.

3 participants