Skip to content

Commit

Permalink
fix(infra): match current user service
Browse files Browse the repository at this point in the history
  • Loading branch information
donghun1214 committed Aug 29, 2024
1 parent ff7e246 commit 9783dd4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions apps/backend/apps/client/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { generate } from 'generate-password'
import { ExtractJwt } from 'passport-jwt'
import { type AuthenticatedRequest, JwtAuthService } from '@libs/auth'
import { emailAuthenticationPinCacheKey } from '@libs/cache'
import { EMAIL_AUTH_EXPIRE_TIME } from '@libs/constants'
import { EMAIL_AUTH_EXPIRE_TIME, ARGON2_HASH_OPTION } from '@libs/constants'
import {
ConflictFoundException,
DuplicateFoundException,
Expand Down Expand Up @@ -198,7 +198,7 @@ export class UserService {
email
},
data: {
password: await hash(newPassword)
password: await hash(newPassword, ARGON2_HASH_OPTION)
}
})
this.logger.debug(user, 'updateUserPasswordInPrisma')
Expand Down Expand Up @@ -394,7 +394,9 @@ export class UserService {
username: socialSignUpDto.username,
password: generate({ length: 10, numbers: true }),
realName: socialSignUpDto.realName,
email: socialSignUpDto.email
email: socialSignUpDto.email,
studentId: socialSignUpDto.studentId,
major: socialSignUpDto.major
})
const profile: CreateUserProfileData = {
userId: user.id,
Expand Down Expand Up @@ -425,13 +427,15 @@ export class UserService {
}

async createUser(signUpDto: SignUpDto): Promise<User> {
const encryptedPassword = await hash(signUpDto.password)
const encryptedPassword = await hash(signUpDto.password, ARGON2_HASH_OPTION)

const user = await this.prisma.user.create({
data: {
username: signUpDto.username,
password: encryptedPassword,
email: signUpDto.email
email: signUpDto.email,
studentId: signUpDto.studentId,
major: signUpDto.major
}
})
this.logger.debug(user, 'createUser')
Expand Down

0 comments on commit 9783dd4

Please sign in to comment.