- 로그인 기능 오류 보완
This commit is contained in:
@@ -66,6 +66,7 @@ export class AccountController {
|
|||||||
@Public()
|
@Public()
|
||||||
@Post('login')
|
@Post('login')
|
||||||
async login(@Body() body: DTO.LoginRequest): Promise<DTO.LoginResponse> {
|
async login(@Body() body: DTO.LoginRequest): Promise<DTO.LoginResponse> {
|
||||||
|
console.log('a');
|
||||||
const result = await this.accountService.login(body);
|
const result = await this.accountService.login(body);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,16 +42,13 @@ export class AccountRepo {
|
|||||||
type: 'email' | 'accountId'
|
type: 'email' | 'accountId'
|
||||||
, id: string
|
, id: string
|
||||||
) {
|
) {
|
||||||
const condition = type === 'email'
|
|
||||||
? eq(schema.account.email, id)
|
|
||||||
: eq(schema.account.accountId, id);
|
|
||||||
return this
|
return this
|
||||||
.db
|
.db
|
||||||
.select()
|
.select()
|
||||||
.from(schema.account)
|
.from(schema.account)
|
||||||
.where(
|
.where(
|
||||||
and(
|
and(
|
||||||
condition,
|
eq(schema.account[type], id),
|
||||||
eq(schema.account.isDeleted, false),
|
eq(schema.account.isDeleted, false),
|
||||||
eq(schema.account.status, 'active')
|
eq(schema.account.status, 'active')
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -78,9 +78,6 @@ 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,
|
||||||
@@ -88,7 +85,6 @@ export class AccountService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user