auth 인증로그
This commit is contained in:
@@ -37,7 +37,7 @@ export class AuthService {
|
|||||||
private readonly verificationService: VerificationService,
|
private readonly verificationService: VerificationService,
|
||||||
private readonly jwtService: JwtService,
|
private readonly jwtService: JwtService,
|
||||||
private readonly configService: ConfigService,
|
private readonly configService: ConfigService,
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 유저 로그인
|
* 유저 로그인
|
||||||
@@ -58,6 +58,9 @@ export class AuthService {
|
|||||||
throw new UnauthorizedException('아이디 또는 비밀번호가 틀렸습니다'); //HTTP 401 상태 코드 예외
|
throw new UnauthorizedException('아이디 또는 비밀번호가 틀렸습니다'); //HTTP 401 상태 코드 예외
|
||||||
}
|
}
|
||||||
// 3. 비밀번호 비교 (bcrypt)
|
// 3. 비밀번호 비교 (bcrypt)
|
||||||
|
const tempHash = await bcrypt.hash(userPassword, 10);
|
||||||
|
console.log('=========input password bcrypt hash========:', tempHash);
|
||||||
|
|
||||||
const isPasswordValid = await bcrypt.compare(userPassword, user.userPw);
|
const isPasswordValid = await bcrypt.compare(userPassword, user.userPw);
|
||||||
if (!isPasswordValid) {
|
if (!isPasswordValid) {
|
||||||
throw new UnauthorizedException('아이디 또는 비밀번호가 틀렸습니다');
|
throw new UnauthorizedException('아이디 또는 비밀번호가 틀렸습니다');
|
||||||
@@ -71,7 +74,7 @@ export class AuthService {
|
|||||||
const payload = {
|
const payload = {
|
||||||
userId: user.userId,
|
userId: user.userId,
|
||||||
userNo: user.pkUserNo,
|
userNo: user.pkUserNo,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Access Token 생성 (기본 설정 사용)
|
// Access Token 생성 (기본 설정 사용)
|
||||||
@@ -134,7 +137,7 @@ export class AuthService {
|
|||||||
if (existingUser.userPhone === userPhone) {
|
if (existingUser.userPhone === userPhone) {
|
||||||
throw new ConflictException('이미 사용 중인 전화번호입니다');
|
throw new ConflictException('이미 사용 중인 전화번호입니다');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 비밀번호 해싱 (bcrypt)
|
// 2. 비밀번호 해싱 (bcrypt)
|
||||||
@@ -147,7 +150,7 @@ export class AuthService {
|
|||||||
userName: signupDto.userName,
|
userName: signupDto.userName,
|
||||||
userPhone: signupDto.userPhone,
|
userPhone: signupDto.userPhone,
|
||||||
userEmail: signupDto.userEmail,
|
userEmail: signupDto.userEmail,
|
||||||
|
|
||||||
regIp: clientIp, // 등록 ip
|
regIp: clientIp, // 등록 ip
|
||||||
regUserId: signupDto.userId,
|
regUserId: signupDto.userId,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user