From 9783dd49922339584640f04e8879e926d02569a5 Mon Sep 17 00:00:00 2001 From: donghun1214 Date: Thu, 29 Aug 2024 10:26:32 +0000 Subject: [PATCH] fix(infra): match current user service --- apps/backend/apps/client/src/user/user.service.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/backend/apps/client/src/user/user.service.ts b/apps/backend/apps/client/src/user/user.service.ts index a47d48b7a0..762e52116d 100644 --- a/apps/backend/apps/client/src/user/user.service.ts +++ b/apps/backend/apps/client/src/user/user.service.ts @@ -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, @@ -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') @@ -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, @@ -425,13 +427,15 @@ export class UserService { } async createUser(signUpDto: SignUpDto): Promise { - 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')