From e4048843e914e4b52f1ace007d7ee5a512610c6a Mon Sep 17 00:00:00 2001 From: Hyang-Dan Date: Tue, 2 Dec 2025 22:31:10 +0900 Subject: [PATCH] =?UTF-8?q?issue=20#41=20-=20=EB=B9=84=EB=B0=80=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EC=B4=88=EA=B8=B0=ED=99=94=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20=EB=B0=8F=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/account/account.service.ts | 14 +++++++++++--- .../verify-reset-password-code-response.dto.ts | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/modules/account/account.service.ts b/src/modules/account/account.service.ts index f8a8066..51d3fe8 100644 --- a/src/modules/account/account.service.ts +++ b/src/modules/account/account.service.ts @@ -78,12 +78,17 @@ export class AccountService { const queryResult = await this.accountRepo.login(type, id); const typeValue = type === 'email' ? '이메일' : '아이디'; + + console.log(queryResult); + if (!queryResult || (queryResult.length < 1)) { return { success: false, message: `존재하지 않는 ${typeValue} 입니다.` }; } + + const hashedPassword = queryResult[0].password; const isPasswordMatch = Converter.comparePassword(password, hashedPassword); if (!isPasswordMatch) { @@ -161,14 +166,16 @@ export class AccountService { if (!storedCode) { return { success: false, - message: "잘못된 이메일이거나 코드가 만료되었습니다." + verified: false, + error: "잘못된 이메일이거나 코드가 만료되었습니다." }; } if (storedCode !== code) { return { success: false, - message: "잘못된 코드입니다." + verified: false, + error: "잘못된 코드입니다." }; } @@ -176,6 +183,7 @@ export class AccountService { return { success: true, + verified: true, message: "비밀번호 초기화 코드 인증 완료" }; } @@ -185,7 +193,7 @@ export class AccountService { const hashedPassword = Converter.getHashedPassword(password); const result = await this.accountRepo.updatePassword('email', email, hashedPassword); - if (result.rows.length === 0) { + if (!result.rowCount || result.rowCount === 0) { return { success: false, error: "비밀번호 초기화 실패" diff --git a/src/modules/account/dto/verifyResetPasswordCode/verify-reset-password-code-response.dto.ts b/src/modules/account/dto/verifyResetPasswordCode/verify-reset-password-code-response.dto.ts index a6f62e5..b76b3a8 100644 --- a/src/modules/account/dto/verifyResetPasswordCode/verify-reset-password-code-response.dto.ts +++ b/src/modules/account/dto/verifyResetPasswordCode/verify-reset-password-code-response.dto.ts @@ -1,4 +1,5 @@ import { BaseResponseDto } from "../base-response.dto"; export class VerifyResetPasswordCodeResponseDto extends BaseResponseDto { + verified: boolean; } \ No newline at end of file