-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/member-email-verify-1: 이메일 인증 로직 추가
- 이메일 인증번호 생성 : POST, Body로 email 전송, redis로 3분 유효 캐시인 인증코드 생성 (약 5초 정도 걸림) - 인증번호 검증 : GET, Param으로 email, verifyCode로 캐시값에서 키 값 가져와 유효성 검증
- Loading branch information
Showing
7 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.dife.api.model.dto; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@RequiredArgsConstructor | ||
public class CheckEmailDto { | ||
|
||
private String email; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.dife.api.model.dto; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@RequiredArgsConstructor | ||
public class VerifyEmailDto { | ||
|
||
private String email; | ||
private String verifyCode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.dife.api.redis; | ||
|
||
import java.time.Duration; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.redis.core.StringRedisTemplate; | ||
import org.springframework.data.redis.core.ValueOperations; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class RedisUtil { | ||
|
||
private final StringRedisTemplate stringRedisTemplate; | ||
|
||
public String getData(String key) { | ||
ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue(); | ||
return valueOperations.get(key); | ||
} | ||
|
||
public void setData(String key, String value) { | ||
ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue(); | ||
valueOperations.set(key, value); | ||
} | ||
|
||
public void setDataExpire(String key, String value, long duration) { | ||
ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue(); | ||
Duration expireDuration = Duration.ofSeconds(duration); | ||
valueOperations.set(key, value, expireDuration); | ||
} | ||
|
||
public void deleteData(String key) { | ||
stringRedisTemplate.delete(key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters