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

Feature: 이메일 인증 기능 구현 #127

Merged
merged 5 commits into from
Jun 28, 2024
Merged

Feature: 이메일 인증 기능 구현 #127

merged 5 commits into from
Jun 28, 2024

Conversation

lcomment
Copy link
Collaborator

Issue Number

#124

Description

메일 전송 관련 기능을 구현하였습니다. 로컬에서 테스트가 안돼서 ec2 환경에서는 잘될지 테스트 해보려합니다. 코드와 로직만 보시면 될 것 같습니다.

Core Code

	public void sendEmailForVerification(final GenerateCodeRequest dto) {
		final String email = dto.email();
		final String code = RandomUtils.generateRandomStringOnlyNumber(6);
		emailVerificationRedisRepository.save(email, code);

		final EmailWithVerificationCodeSendEvent emailEvent = EventMapper.supplyEmailWithVerificationCodeSendEventBy(email, code);
		applicationEventPublisher.publishEvent(emailEvent);
	}

	public void checkEmailVerificationCode(final VerifyEmailRequest dto) {
		final String email = dto.email();
		final String code = dto.code();
		final String verificationCode = emailVerificationRedisRepository.findCodeByEmail(email);

		if (isNull(verificationCode) || !verificationCode.equals(code)) {
			throw new CakkException(ReturnCode.WRONG_VERIFICATION_CODE);
		}

		emailVerificationRedisRepository.deleteByEmail(email);
	}

etc

@lcomment lcomment added the feature 새로운 기능 개발 label Jun 28, 2024
@lcomment lcomment requested a review from YongsHub June 28, 2024 02:00
@lcomment lcomment self-assigned this Jun 28, 2024
@lcomment lcomment changed the title Feature/#124 Feature: 이메일 인증 기능 구현 Jun 28, 2024
Copy link

Test Results

111 tests   110 ✅  13s ⏱️
 17 suites    1 💤
 17 files      0 ❌

Results for commit 313bd00.

Copy link
Contributor

@YongsHub YongsHub left a comment

Choose a reason for hiding this comment

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

고생하셨습니다

import com.cakk.external.service.MailService;

@RequiredArgsConstructor
@Component
Copy link
Contributor

Choose a reason for hiding this comment

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

Listener 부분도 @component를 메타 애노테이션으로 갖는 @eventlistener 같은거 만들어주실 수 있나요?

Copy link
Collaborator Author

@lcomment lcomment Jun 28, 2024

Choose a reason for hiding this comment

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

나중에 만들어서 일괄 적용하겠습니다! 확실히 Component 어노테이션은 안 이쁘네요

@@ -0,0 +1,18 @@
package com.cakk.common.utils;

public class RandomUtils {
Copy link
Contributor

Choose a reason for hiding this comment

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

생성자 엑세스 레벨 관리하는건 어떤가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

private으로 두었습니다.

@lcomment lcomment merged commit 8a3daa2 into master Jun 28, 2024
2 checks passed
@lcomment lcomment deleted the feature/#124 branch June 28, 2024 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 새로운 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants