@@ -78,12 +78,17 @@ export class AccountService {
|
|||||||
const queryResult = await this.accountRepo.login(type, id);
|
const queryResult = await this.accountRepo.login(type, id);
|
||||||
const typeValue = type === 'email' ? '이메일' : '아이디';
|
const typeValue = type === 'email' ? '이메일' : '아이디';
|
||||||
|
|
||||||
|
|
||||||
|
console.log(queryResult);
|
||||||
|
|
||||||
if (!queryResult || (queryResult.length < 1)) {
|
if (!queryResult || (queryResult.length < 1)) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
message: `존재하지 않는 ${typeValue} 입니다.`
|
message: `존재하지 않는 ${typeValue} 입니다.`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const hashedPassword = queryResult[0].password;
|
const hashedPassword = queryResult[0].password;
|
||||||
const isPasswordMatch = Converter.comparePassword(password, hashedPassword);
|
const isPasswordMatch = Converter.comparePassword(password, hashedPassword);
|
||||||
if (!isPasswordMatch) {
|
if (!isPasswordMatch) {
|
||||||
@@ -161,14 +166,16 @@ export class AccountService {
|
|||||||
if (!storedCode) {
|
if (!storedCode) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
message: "잘못된 이메일이거나 코드가 만료되었습니다."
|
verified: false,
|
||||||
|
error: "잘못된 이메일이거나 코드가 만료되었습니다."
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedCode !== code) {
|
if (storedCode !== code) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
message: "잘못된 코드입니다."
|
verified: false,
|
||||||
|
error: "잘못된 코드입니다."
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,6 +183,7 @@ export class AccountService {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
|
verified: true,
|
||||||
message: "비밀번호 초기화 코드 인증 완료"
|
message: "비밀번호 초기화 코드 인증 완료"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -185,7 +193,7 @@ export class AccountService {
|
|||||||
const hashedPassword = Converter.getHashedPassword(password);
|
const hashedPassword = Converter.getHashedPassword(password);
|
||||||
const result = await this.accountRepo.updatePassword('email', email, hashedPassword);
|
const result = await this.accountRepo.updatePassword('email', email, hashedPassword);
|
||||||
|
|
||||||
if (result.rows.length === 0) {
|
if (!result.rowCount || result.rowCount === 0) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: "비밀번호 초기화 실패"
|
error: "비밀번호 초기화 실패"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { BaseResponseDto } from "../base-response.dto";
|
import { BaseResponseDto } from "../base-response.dto";
|
||||||
|
|
||||||
export class VerifyResetPasswordCodeResponseDto extends BaseResponseDto {
|
export class VerifyResetPasswordCodeResponseDto extends BaseResponseDto {
|
||||||
|
verified: boolean;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user