Skip to content

Commit

Permalink
Merge pull request #243 from readyvery/test
Browse files Browse the repository at this point in the history
Fix: 번호 인증코드 문자 -> 6자리 숫자로 변경
  • Loading branch information
1223v authored Apr 4, 2024
2 parents 2af577d + 74efc5a commit 4f984b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public Optional<String> extractAccessToken(HttpServletRequest request) {
public Optional<String> extractEmail(String accessToken) {
try {
// 토큰 유효성 검사하는 데에 사용할 알고리즘이 있는 JWT verifier builder 반환
log.info("액세스 토큰 유효성 검사");

return jwtTokenizer.verifyAccessToken(accessToken);
} catch (Exception e) {
log.error("액세스 토큰이 유효하지 않습니다.");
Expand Down
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 4f984b1

Please sign in to comment.