add-nest-auth 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,8 @@ import { JwtModule } from '@nestjs/jwt';
3
3
  import { PassportModule } from '@nestjs/passport';
4
4
  import { ConfigModule, ConfigService } from '@nestjs/config';
5
5
  {{#if features.rateLimiting}}
6
- import { ThrottlerModule } from '@nestjs/throttler';
6
+ import { ThrottlerModule, ThrottlerGuard } from '@nestjs/throttler';
7
+ import { APP_GUARD } from '@nestjs/core';
7
8
  {{/if}}
8
9
  {{#if (eq orm "typeorm")}}
9
10
  import { TypeOrmModule } from '@nestjs/typeorm';
@@ -56,7 +57,17 @@ import { RefreshToken } from '../users/entities/refresh-token.entity';
56
57
  {{/if}}
57
58
  ],
58
59
  controllers: [AuthController],
59
- providers: [AuthService, JwtStrategy, LocalStrategy],
60
+ providers: [
61
+ AuthService,
62
+ JwtStrategy,
63
+ LocalStrategy,
64
+ {{#if features.rateLimiting}}
65
+ {
66
+ provide: APP_GUARD,
67
+ useClass: ThrottlerGuard,
68
+ },
69
+ {{/if}}
70
+ ],
60
71
  exports: [AuthService],
61
72
  })
62
73
  export class AuthModule {}
@@ -93,7 +93,7 @@ export class AuthService {
93
93
  * User registration
94
94
  */
95
95
  async register(registerDto: RegisterDto): Promise<AuthResponseDto> {
96
- const bcryptRounds = this.configService.get<number>('BCRYPT_ROUNDS', 10);
96
+ const bcryptRounds = parseInt(this.configService.get('BCRYPT_ROUNDS', '10'), 10);
97
97
  const hashedPassword = await bcrypt.hash(registerDto.password, bcryptRounds);
98
98
 
99
99
  const user = await this.usersService.create({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "add-nest-auth",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Add production-ready authentication to any NestJS project in 60 seconds",
5
5
  "keywords": [
6
6
  "nestjs",