Skip to content

Commit

Permalink
Merge pull request #241 from 1223v/test
Browse files Browse the repository at this point in the history
Fix: 번호 인증코드 문자 -> 6자리 숫자로 변경
  • Loading branch information
1223v authored Apr 4, 2024
2 parents 30a440d + e464ca2 commit f4dd61b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.readyvery.readyverydemo.src.smsauthentication;

import java.util.UUID;
import java.util.concurrent.TimeUnit;

import org.springframework.data.redis.core.RedisTemplate;
Expand All @@ -15,7 +14,10 @@ public class VerificationService {
private final RedisTemplate<String, String> redisTemplate;

public String createVerificationCode(String phoneNumber, boolean someBooleanValue) {
String code = UUID.randomUUID().toString().substring(0, 6);
//String code = UUID.randomUUID().toString().substring(0, 6);
int sixDigitNumber = (int)(Math.random() * 900000) + 100000; // 100000 ~ 999999 사이의 숫자
String code = Integer.toString(sixDigitNumber); // 숫자를 문자열로 변환

redisTemplate.opsForValue().set(phoneNumber + ":code", code, 3, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(phoneNumber + ":flag", String.valueOf(someBooleanValue), 3, TimeUnit.MINUTES);
return code;
Expand Down

0 comments on commit f4dd61b

Please sign in to comment.