Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: 번호 인증코드 문자 -> 6자리 숫자로 변경 #243

Merged
merged 4 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading