chore(deps): update dependencies to latest

This commit is contained in:
Amruth Pillai
2022-03-24 08:37:57 +01:00
parent f6d7cae17b
commit 25a6b8cce6
5 changed files with 369 additions and 343 deletions

View File

@ -22,8 +22,12 @@ export class AuthService {
private jwtService: JwtService
) {}
private getRandomSaltRounds(min: number, max: number) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
async register(registerDto: RegisterDto) {
const hashedPassword = await bcrypt.hash(registerDto.password, 10);
const hashedPassword = await bcrypt.hash(registerDto.password, this.getRandomSaltRounds(10, 20));
try {
const createdUser = await this.usersService.create({
@ -74,7 +78,7 @@ export class AuthService {
async resetPassword(resetPasswordDto: ResetPasswordDto) {
const user = await this.usersService.findByResetToken(resetPasswordDto.resetToken);
const hashedPassword = await bcrypt.hash(resetPasswordDto.password, 10);
const hashedPassword = await bcrypt.hash(resetPasswordDto.password, this.getRandomSaltRounds(10, 20));
await this.usersService.update(user.id, {
password: hashedPassword,