Skip to content

Commit

Permalink
Merge pull request #93 from 1223v/sale
Browse files Browse the repository at this point in the history
Fix: redis 번호인증 시간 변경(5min->3min)
  • Loading branch information
1223v authored Mar 26, 2024
2 parents 6f9c3ba + 94ec004 commit 8ec5f19
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class VerificationService {

public String createVerificationCode(String phoneNumber, boolean someBooleanValue) {
String code = UUID.randomUUID().toString().substring(0, 6);
redisTemplate.opsForValue().set(phoneNumber + ":code", code, 5, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(phoneNumber + ":flag", String.valueOf(someBooleanValue), 5, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(phoneNumber + ":code", code, 3, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(phoneNumber + ":flag", String.valueOf(someBooleanValue), 3, TimeUnit.MINUTES);
return code;
}

Expand All @@ -28,7 +28,7 @@ public boolean verifyCode(String phoneNumber, String code) {
String storedCode = redisTemplate.opsForValue().get(storedCodeKey);
if (storedCode != null && storedCode.equals(code)) {
// 인증 코드가 일치하면 플래그 값을 true로 설정
redisTemplate.opsForValue().set(flagKey, "true", 5, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(flagKey, "true", 3, TimeUnit.MINUTES);
return true;
} else {
return false;
Expand All @@ -47,8 +47,8 @@ public boolean verifyNumberToChangePassword(String phoneNumber) {

public String createVerificationCodeToChangePassword(String phoneNumber, boolean someBooleanValue) {
String code = UUID.randomUUID().toString().substring(0, 6);
redisTemplate.opsForValue().set(phoneNumber + ":pwcode", code, 5, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(phoneNumber + ":pwflag", String.valueOf(someBooleanValue), 5, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(phoneNumber + ":pwcode", code, 3, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(phoneNumber + ":pwflag", String.valueOf(someBooleanValue), 3, TimeUnit.MINUTES);
return code;
}

Expand All @@ -59,7 +59,7 @@ public boolean verifyCodeToChangePassword(String phoneNumber, String code) {
String storedCode = redisTemplate.opsForValue().get(storedCodeKey);
if (storedCode != null && storedCode.equals(code)) {
// 인증 코드가 일치하면 플래그 값을 true로 설정
redisTemplate.opsForValue().set(flagKey, "true", 5, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(flagKey, "true", 3, TimeUnit.MINUTES);
return true;
} else {
return false;
Expand Down

0 comments on commit 8ec5f19

Please sign in to comment.