mirror of
https://github.com/Kevsl/crypto-exchange-api.git
synced 2025-07-09 14:00:12 +02:00
tryed to remove bcrypt for bcryptjs
This commit is contained in:
parent
3d38030791
commit
e114468157
@ -1,7 +1,8 @@
|
||||
import { ForbiddenException, Injectable } from '@nestjs/common';
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import { AuthLoginDto, AuthRegisterDto } from './dto';
|
||||
import * as argon from 'argon2';
|
||||
import bcrypt from 'bcryptjs';
|
||||
|
||||
import { Prisma, User } from '@prisma/client';
|
||||
import { JwtService } from '@nestjs/jwt';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
@ -15,7 +16,7 @@ export class AuthService {
|
||||
) {}
|
||||
|
||||
async signup(dto: AuthRegisterDto) {
|
||||
const hash = await argon.hash(dto.password);
|
||||
const hash = await bcrypt.hashSync(dto.password);
|
||||
const promoCode = await this.prisma.promoCode.findFirst({
|
||||
where: {
|
||||
name: dto.promoCode,
|
||||
@ -73,7 +74,8 @@ export class AuthService {
|
||||
});
|
||||
if (!userDatas) throw new ForbiddenException('Credentials incorrect');
|
||||
|
||||
const pwMatches = await argon.verify(userDatas.hash, dto.password);
|
||||
const pwMatches = await bcrypt.compareSync(userDatas.hash, dto.password);
|
||||
|
||||
if (!pwMatches) throw new ForbiddenException('Credentials incorrect');
|
||||
|
||||
return this.signToken(userDatas);
|
||||
|
Loading…
x
Reference in New Issue
Block a user