비밀번호 해시값 다시 반영
This commit is contained in:
@@ -57,9 +57,8 @@ export class AuthService {
|
||||
if (!user) {
|
||||
throw new UnauthorizedException('아이디 또는 비밀번호가 틀렸습니다'); //HTTP 401 상태 코드 예외
|
||||
}
|
||||
// 3. 비밀번호 비교 (bcrypt) - TODO: 나중에 해시 적용
|
||||
// const isPasswordValid = await bcrypt.compare(userPassword, user.userPw);
|
||||
const isPasswordValid = userPassword === user.userPw; // 평문 비교 (임시)
|
||||
// 3. 비밀번호 비교 (bcrypt)
|
||||
const isPasswordValid = await bcrypt.compare(userPassword, user.userPw);
|
||||
if (!isPasswordValid) {
|
||||
throw new UnauthorizedException('아이디 또는 비밀번호가 틀렸습니다');
|
||||
}
|
||||
@@ -138,13 +137,13 @@ export class AuthService {
|
||||
|
||||
}
|
||||
|
||||
// 2. 비밀번호 해싱 (bcrypt) - TODO: 나중에 해시 적용
|
||||
// const saltRounds = parseInt(this.configService.get<string>('BCRYPT_SALT_ROUNDS') || '10', 10);
|
||||
// const hashedPassword = await bcrypt.hash(signupDto.userPassword, saltRounds);
|
||||
// 2. 비밀번호 해싱 (bcrypt)
|
||||
const saltRounds = parseInt(this.configService.get<string>('BCRYPT_SALT_ROUNDS') || '10', 10);
|
||||
const hashedPassword = await bcrypt.hash(signupDto.userPassword, saltRounds);
|
||||
// 3. 사용자 생성
|
||||
const newUser = this.userRepository.create({
|
||||
userId: signupDto.userId,
|
||||
userPw: signupDto.userPassword, // 평문 저장 (임시)
|
||||
userPw: hashedPassword,
|
||||
userName: signupDto.userName,
|
||||
userPhone: signupDto.userPhone,
|
||||
userEmail: signupDto.userEmail,
|
||||
@@ -479,12 +478,12 @@ export class AuthService {
|
||||
throw new NotFoundException('사용자를 찾을 수 없습니다');
|
||||
}
|
||||
|
||||
// 3. 새 비밀번호 해싱 - TODO: 나중에 해시 적용
|
||||
// const saltRounds = parseInt(this.configService.get<string>('BCRYPT_SALT_ROUNDS') || '10', 10);
|
||||
// const hashedPassword = await bcrypt.hash(newPassword, saltRounds);
|
||||
// 3. 새 비밀번호 해싱
|
||||
const saltRounds = parseInt(this.configService.get<string>('BCRYPT_SALT_ROUNDS') || '10', 10);
|
||||
const hashedPassword = await bcrypt.hash(newPassword, saltRounds);
|
||||
|
||||
// 4. 비밀번호 업데이트
|
||||
user.userPw = newPassword; // 평문 저장 (임시)
|
||||
user.userPw = hashedPassword;
|
||||
await this.userRepository.save(user);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user