Merge fix(비번초기화): 키 불일치 + 입력값 무시 픽스
Build & Deploy to K8s / build-and-deploy (push) Failing after 11m15s

This commit is contained in:
2026-05-12 19:28:02 +09:00
3 changed files with 15 additions and 4 deletions
@@ -295,7 +295,8 @@ public class AdminController {
@PostMapping("/users/reset-password")
public ResponseEntity<ApiResponse<Void>> resetUserPassword(@RequestBody Map<String, Object> body) {
String userId = (String) body.get("user_id");
adminService.resetUserPassword(userId);
String newPassword = (String) body.get("new_password");
adminService.resetUserPassword(userId, newPassword);
return ResponseEntity.ok(ApiResponse.success(null, "비밀번호 초기화 성공"));
}
@@ -208,10 +208,17 @@ public class AdminService extends BaseService {
}
public void resetUserPassword(String userId) {
String defaultPw = passwordEncoder.encode("Welcome1!");
resetUserPassword(userId, null);
}
public void resetUserPassword(String userId, String newPassword) {
if (userId == null || userId.isBlank()) {
throw new IllegalArgumentException("user_id 는 필수입니다");
}
String rawPw = (newPassword != null && !newPassword.isBlank()) ? newPassword : "Welcome1!";
Map<String, Object> params = new HashMap<>();
params.put("user_id", userId);
params.put("user_password", defaultPw);
params.put("user_password", passwordEncoder.encode(rawPw));
sqlSession.update("admin.updateUserPassword", params);
}
+4 -1
View File
@@ -199,7 +199,10 @@ export async function getUserHistory(userId: string, params?: Record<string, any
* 사용자 비밀번호 초기화
*/
export async function resetUserPassword(resetData: { userId: string; newPassword: string }) {
const response = await apiClient.post("/admin/users/reset-password", resetData);
const response = await apiClient.post("/admin/users/reset-password", {
user_id: resetData.userId,
new_password: resetData.newPassword,
});
return response.data;
}