feat: hash password on register
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
export class CreateUserDto {
|
||||
email: string;
|
||||
name: string;
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { CreateUserDto } from './dto/create-user.dto';
|
||||
import { UpdateUserDto } from './dto/update-user.dto';
|
||||
import { User, Prisma } from '@prisma/client';
|
||||
import { PrismaService } from 'src/prisma/prisma.service';
|
||||
import * as bcrypt from 'bcryptjs';
|
||||
|
||||
@Injectable()
|
||||
export class UsersService {
|
||||
@@ -35,7 +36,7 @@ export class UsersService {
|
||||
}
|
||||
|
||||
async createUser(data: Prisma.UserCreateInput): Promise<User> {
|
||||
console.log(data)
|
||||
data.password = await bcrypt.hash(data.password, 8)
|
||||
return this.prisma.user.create({
|
||||
data,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user