Skip to content

[feat] #2 - 이메일 인증 기반 회원가입/로그인 API 구현 - #6

Merged
sae2say merged 15 commits into
mainfrom
feat/#2
Jul 22, 2026
Merged

[feat] #2 - 이메일 인증 기반 회원가입/로그인 API 구현#6
sae2say merged 15 commits into
mainfrom
feat/#2

Conversation

@sae2say

@sae2say sae2say commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Related issue 🛠

Work Description ✏️

이메일 인증 / 회원가입 / 로그인

  • Gmail SMTP(JavaMailSender) 기반으로 이메일 인증 방식의 회원가입·로그인 플로우를 구현했습니다.
  • 인증 코드 메일 전송 - 6자리 숫자 인증코드를 생성해 메일로 발송하고, 키로 Redis에 저장합니다(TTL 5분).
  • 인증 코드 메일 재전송 - 일반 메일 전송과 동일한 로직이되, 기존 redis 데이터를 덮어씁니다.
  • 검증 성공 시 인증코드는 삭제하고, 회원가입까지 사용할 인증 완료 마커를 저장합니다(TTL 30분). 회원가입이 완료되면 마커도 삭제해 1회성으로 처리합니다.
  • 비밀번호는 암호화하여 저장합니다.

약관 동의

  • 약관을 담는 Terms와 약관 동의 항목을 담는 TermsAgreement 테이블을 생성하였습니다.
  • 회원가입 뷰에서 약관 목록을 조회하는 API를 구현하였습니다.
  • 회원가입 시 동의 약관 목록을 함께 입력받습니다.

Trouble Shooting ⚽️

Related ScreenShot 📷

인증 코드 발송 API

image

인증 코드 검증 API

image

약관 목록 조회 API

image

회원가입 API

image

로그인 API

image

Uncompleted Tasks 😅

To Reviewers 📢

@laura-jung laura-jung left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

역시 깔끔 그자체네요....! 많이 배워갑니다아....
제가 아는 선에서 코멘트 조금 달아두어서 확인부탁드립니다!

"/api/auth/reissue",
"/api/auth/email/**",
"/api/auth/signup",
"/api/auth/terms",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

이부분은 termsController의 getTerms와 다른 경로인건가요? 만약 같은 경로라면 경로 수정해야할 것 같습니다!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

getTerms는 메서드 네임이고 이 메서드에 매핑되는 엔드포인트는 /api/auth/terms가 맞습니다!


Member member = memberRepository.save(
Member.create(request.email(), passwordEncoder.encode(request.password()), Role.ONBOARDING)
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

동일 이메일로 회원가입 요청 두 개가 동시에 들어오면 두 이메일 모두 중복 검사를 통과할 수 있을 것 같네요....
DB에 이메일 unique 인덱스를 추가하는게 어떨까요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

심사 기준에서 소스코드의 완성도를 크게 보는 것 같다고 생각하지 않았어서( 공모전 안내사항에 'AI 사용 가능. 작동 가능하기만 하면 된다'고 명시되어 있었던 것 같음) 동시성이나 성능을 따로 고려하지 않았습니다.. ㅎ
추후 시간여유가 된다면 작업해보는 것도 좋을 것 같습니다!

Comment on lines +50 to +61
public void verify(final String email, final String inputCode) {
String storedCode = codeStore.getCode(email)
.orElseThrow(() -> new JjinException(MemberErrorCode.VERIFICATION_CODE_NOT_FOUND));

if (!storedCode.equals(inputCode)) {
throw new JjinException(MemberErrorCode.VERIFICATION_CODE_MISMATCH);
}

codeStore.deleteCode(email);
codeStore.markVerified(email, verifiedTtlSeconds);
log.info("이메일 인증 완료: email={}", email);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

현재 이메일 인증에 대한 시도 횟수가 따로 제한되어있지는 않은 것 같습니다! 저도 이번에 알게된 내용인데 메일 재전송 API에도 쿨다운이 있어야 SMTP 스팸과 쿼터 소진을 막을 수 있다고 합니다....! 지금 당장 중요한 기능은 아니지만 도입해보면 좋을 것 같아요!

@sae2say
sae2say merged commit 67cc134 into main Jul 22, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 이메일 인증 기반 일반 회원가입 / 로그인 구현

2 participants