Skip to content

Commit

Permalink
Merge pull request #178 from Re-4aliens/hotfix/email_encrypt
Browse files Browse the repository at this point in the history
Hotfix 반복 인증 요청시 이메일 암호화 로직으로 인해 가입 진행이 불가능하여 로직 임시 삭제
  • Loading branch information
mjj111 authored Oct 8, 2024
2 parents 918c098 + 8c2e18a commit 1258691
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
import com.aliens.backend.email.controller.response.EmailResponse;
import com.aliens.backend.email.domain.EmailAuthentication;
import com.aliens.backend.email.domain.repository.EmailAuthenticationRepository;
import com.aliens.backend.member.sevice.SymmetricKeyEncoder;
import com.aliens.backend.global.response.error.EmailError;
import com.aliens.backend.global.exception.RestApiException;
import com.aliens.backend.global.response.error.EmailError;
import com.aliens.backend.member.controller.dto.event.TemporaryPasswordEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -48,7 +47,7 @@ public String sendAuthenticationEmail(final String email) {
EmailAuthentication emailEntity = new EmailAuthentication(email);
emailAuthenticationRepository.save(emailEntity);

String emailToken = SymmetricKeyEncoder.encrypt(email);
String emailToken = email;
emailSender.sendAuthenticationEmail(email, emailToken);

return EmailResponse.EMAIL_SEND_SUCCESS.getMessage();
Expand All @@ -68,7 +67,7 @@ private void deleteExistsEmail(final String email) {

@Transactional
public String authenticateEmail(final String token) {
String email = SymmetricKeyEncoder.decrypt(token);
String email = token;
EmailAuthentication emailEntity = getEmailAuthenticationByEmail(email);
emailEntity.authenticate();
return EmailResponse.EMAIL_AUTHENTICATION_SUCCESS.getMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ void sendAuthenticationEmailTest() throws Exception {
void authenticateEmailTest() throws Exception {
//Given
emailAuthenticationRepository.save(emailEntity);
String token = symmetricKeyEncoder.encrypt(givenEmail);

//When
String result = emailService.authenticateEmail(token);
String result = emailService.authenticateEmail(givenEmail);

//Then
Assertions.assertEquals(EmailResponse.EMAIL_AUTHENTICATION_SUCCESS.getMessage(), result);
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ spring:
path: /h2-console
data:
mongodb:
uri: mongodb://localhost:27017/database?serverSelectionTimeoutMS=10000
uri: mongodb://localhost:27017/database?serverSelectionTimeoutMS=10000

0 comments on commit 1258691

Please sign in to comment.