Compare commits

...

2 Commits

Author SHA1 Message Date
1611026688 issue #39
All checks were successful
Test CI / build (push) Successful in 1m17s
- 로그인 기능 오류 보완
2025-12-02 22:31:36 +09:00
e4048843e9 issue #41
- 비밀번호 초기화 로직 구현 및 테스트 완료
2025-12-02 22:31:10 +09:00
4 changed files with 10 additions and 7 deletions

View File

@@ -66,6 +66,7 @@ export class AccountController {
@Public()
@Post('login')
async login(@Body() body: DTO.LoginRequest): Promise<DTO.LoginResponse> {
console.log('a');
const result = await this.accountService.login(body);
return result;
}

View File

@@ -42,16 +42,13 @@ export class AccountRepo {
type: 'email' | 'accountId'
, id: string
) {
const condition = type === 'email'
? eq(schema.account.email, id)
: eq(schema.account.accountId, id);
return this
.db
.select()
.from(schema.account)
.where(
and(
condition,
eq(schema.account[type], id),
eq(schema.account.isDeleted, false),
eq(schema.account.status, 'active')
)

View File

@@ -84,6 +84,7 @@ export class AccountService {
message: `존재하지 않는 ${typeValue} 입니다.`
};
}
const hashedPassword = queryResult[0].password;
const isPasswordMatch = Converter.comparePassword(password, hashedPassword);
if (!isPasswordMatch) {
@@ -161,14 +162,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 +179,7 @@ export class AccountService {
return {
success: true,
verified: true,
message: "비밀번호 초기화 코드 인증 완료"
};
}
@@ -185,7 +189,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: "비밀번호 초기화 실패"

View File

@@ -1,4 +1,5 @@
import { BaseResponseDto } from "../base-response.dto";
export class VerifyResetPasswordCodeResponseDto extends BaseResponseDto {
verified: boolean;
}