refactor: 비밀번호 검증 로직 및 암호화 방식 개선

- 비밀번호 길이 검증 로직 제거: 비밀번호 길이 검증을 서버에서 처리하지 않도록 변경하여 클라이언트 측에서 유효성 검사를 수행하도록 함.
- 암호화 방식 변경: 기존의 암호화 로직을 EncryptUtil을 사용하여 간소화하고 일관성을 유지함.
- 사용자 비밀번호 재설정 시 알림 상태 초기화: 비밀번호 재설정 모달에서 알림 상태를 초기화하여 사용자 경험 개선.
This commit is contained in:
kjs
2026-04-02 16:00:50 +09:00
parent 710486cf2f
commit 3dacd15a92
2 changed files with 3 additions and 21 deletions

View File

@@ -3728,16 +3728,6 @@ export const resetUserPassword = async (
return;
}
// 비밀번호 길이 검증 (최소 4자)
if (newPassword.length < 4) {
res.status(400).json({
success: false,
result: false,
message: "비밀번호는 최소 4자 이상이어야 합니다.",
msg: "비밀번호는 최소 4자 이상이어야 합니다.",
});
return;
}
try {
// 1. Raw Query로 사용자 존재 여부 확인
@@ -3756,19 +3746,10 @@ export const resetUserPassword = async (
return;
}
// 2. 비밀번호 암호화 (기존 Java 로직과 동일)
// 2. 비밀번호 암호화 (EncryptUtil 사용)
let encryptedPassword: string;
try {
// EncryptUtil과 동일한 암호화 사용
const crypto = require("crypto");
const keyName = "ILJIAESSECRETKEY";
const algorithm = "aes-128-ecb";
// AES-128-ECB 암호화
const cipher = crypto.createCipher(algorithm, keyName);
let encrypted = cipher.update(newPassword, "utf8", "hex");
encrypted += cipher.final("hex");
encryptedPassword = encrypted.toUpperCase();
encryptedPassword = EncryptUtil.encrypt(newPassword);
} catch (encryptError) {
logger.error("비밀번호 암호화 중 오류 발생", {
error: encryptError,

View File

@@ -114,6 +114,7 @@ export function UserPasswordResetModal({ isOpen, onClose, userId, userName, onSu
setShowPassword(false);
setShowConfirmPassword(false);
setIsLoading(false);
setAlertState({ isOpen: false, type: "info", title: "", message: "" });
onClose();
}, [onClose]);