Compare commits
3 Commits
0f0717fc79
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 91e4f987ea | |||
| 1611026688 | |||
| e4048843e9 |
@@ -1,3 +1,4 @@
|
|||||||
|
HOST=0.0.0.0
|
||||||
PORT=3000
|
PORT=3000
|
||||||
|
|
||||||
# PostgreSQL 설정
|
# PostgreSQL 설정
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ async function bootstrap() {
|
|||||||
if (!origin) return callback(null, true);
|
if (!origin) return callback(null, true);
|
||||||
|
|
||||||
// 특정 도메인만 막고 싶은 경우 whitelist 가능
|
// 특정 도메인만 막고 싶은 경우 whitelist 가능
|
||||||
const whitelist = ["http://localhost:5173", "https://scheduler.bkdhome.p-e.kr"];
|
const whitelist = ["http://localhost:5173", "http://192.168.219.105:5185", "https://scheduler.bkdhome.p-e.kr"];
|
||||||
if (whitelist.includes(origin)) {
|
if (whitelist.includes(origin)) {
|
||||||
return callback(null, true);
|
return callback(null, true);
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ async function bootstrap() {
|
|||||||
|
|
||||||
app.enableShutdownHooks();
|
app.enableShutdownHooks();
|
||||||
app.useGlobalFilters(new AllExceptionsFilter());
|
app.useGlobalFilters(new AllExceptionsFilter());
|
||||||
await app.listen(process.env.PORT ?? 3000, () => { process.env.NODE_ENV !== 'prod' && console.log(`servier is running on ${process.env.PORT}`) });
|
await app.listen(process.env.PORT ?? 3000, '0.0.0.0', () => { process.env.NODE_ENV !== 'prod' && console.log(`servier is running on ${process.env.PORT}`) });
|
||||||
|
|
||||||
}
|
}
|
||||||
bootstrap();
|
bootstrap();
|
||||||
|
|||||||
@@ -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')
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ export class AccountService {
|
|||||||
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 +162,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 +179,7 @@ export class AccountService {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
|
verified: true,
|
||||||
message: "비밀번호 초기화 코드 인증 완료"
|
message: "비밀번호 초기화 코드 인증 완료"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -185,7 +189,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