listo recapcha
This commit is contained in:
parent
70d96abbf1
commit
91a71c60e9
40
package-lock.json
generated
40
package-lock.json
generated
@ -20,6 +20,7 @@
|
||||
"@nestjs/swagger": "^5.2.1",
|
||||
"@nestjs/typeorm": "^8.0.3",
|
||||
"@nestjs/websockets": "^8.4.4",
|
||||
"@nestlab/google-recaptcha": "^3.0.3",
|
||||
"bcrypt": "^5.0.1",
|
||||
"class-transformer": "^0.5.1",
|
||||
"class-validator": "^0.13.2",
|
||||
@ -1375,6 +1376,20 @@
|
||||
"node-pre-gyp": "bin/node-pre-gyp"
|
||||
}
|
||||
},
|
||||
"node_modules/@nestjs/axios": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-0.1.0.tgz",
|
||||
"integrity": "sha512-b2TT2X6BFbnNoeteiaxCIiHaFcSbVW+S5yygYqiIq5i6H77yIU3IVuLdpQkHq8/EqOWFwMopLN8jdkUT71Am9w==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"axios": "0.27.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^7.0.0 || ^8.0.0 || ^9.0.0",
|
||||
"reflect-metadata": "^0.1.12",
|
||||
"rxjs": "^6.0.0 || ^7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@nestjs/cli": {
|
||||
"version": "8.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/cli/-/cli-8.2.6.tgz",
|
||||
@ -1710,6 +1725,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@nestlab/google-recaptcha": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestlab/google-recaptcha/-/google-recaptcha-3.0.3.tgz",
|
||||
"integrity": "sha512-t2xBd/vRd9NHXJGl2H186/Na/LIfR2Gc8InfZaTmHUjkG5RD2ILH8yf6zcye5oE6CrNHTSEtAZV/sBHwjzKHvw==",
|
||||
"peerDependencies": {
|
||||
"@nestjs/axios": ">=0.0.1 <1.0.0",
|
||||
"@nestjs/common": ">=8.0.0 <10.0.0",
|
||||
"@nestjs/core": ">=8.0.0 <10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
@ -11091,6 +11116,15 @@
|
||||
"tar": "^6.1.11"
|
||||
}
|
||||
},
|
||||
"@nestjs/axios": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-0.1.0.tgz",
|
||||
"integrity": "sha512-b2TT2X6BFbnNoeteiaxCIiHaFcSbVW+S5yygYqiIq5i6H77yIU3IVuLdpQkHq8/EqOWFwMopLN8jdkUT71Am9w==",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"axios": "0.27.2"
|
||||
}
|
||||
},
|
||||
"@nestjs/cli": {
|
||||
"version": "8.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/cli/-/cli-8.2.6.tgz",
|
||||
@ -11267,6 +11301,12 @@
|
||||
"tslib": "2.4.0"
|
||||
}
|
||||
},
|
||||
"@nestlab/google-recaptcha": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@nestlab/google-recaptcha/-/google-recaptcha-3.0.3.tgz",
|
||||
"integrity": "sha512-t2xBd/vRd9NHXJGl2H186/Na/LIfR2Gc8InfZaTmHUjkG5RD2ILH8yf6zcye5oE6CrNHTSEtAZV/sBHwjzKHvw==",
|
||||
"requires": {}
|
||||
},
|
||||
"@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
|
@ -32,6 +32,7 @@
|
||||
"@nestjs/swagger": "^5.2.1",
|
||||
"@nestjs/typeorm": "^8.0.3",
|
||||
"@nestjs/websockets": "^8.4.4",
|
||||
"@nestlab/google-recaptcha": "^3.0.3",
|
||||
"bcrypt": "^5.0.1",
|
||||
"class-transformer": "^0.5.1",
|
||||
"class-validator": "^0.13.2",
|
||||
|
@ -10,14 +10,14 @@ import { Socket, Server } from 'socket.io';
|
||||
@WebSocketGateway({
|
||||
cors: {
|
||||
origin: [
|
||||
// 'http://localhost:3176',
|
||||
// 'http://localhost:3186',
|
||||
'http://localhost:3176',
|
||||
'http://localhost:3186',
|
||||
// 'http://132.248.80.196:3155',
|
||||
// 'http://132.248.80.196:3185',
|
||||
// 'https://pmodulospcpuma.unam.mx',
|
||||
// 'http://pmodulospcpuma.unam.mx:3015',
|
||||
'https://modulospcpuma.unam.mx',
|
||||
'https://modulospcpuma.unam.mx:3015',
|
||||
// 'https://modulospcpuma.unam.mx',
|
||||
// 'https://modulospcpuma.unam.mx:3015',
|
||||
],
|
||||
},
|
||||
})
|
||||
|
@ -1,6 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import {
|
||||
GoogleRecaptchaModule,
|
||||
GoogleRecaptchaNetwork,
|
||||
} from '@nestlab/google-recaptcha';
|
||||
|
||||
import { AuthModule } from './auth/auth.module';
|
||||
import { BcryptModule } from './bcrypt/bcrypt.module';
|
||||
@ -19,6 +23,7 @@ import { InstitucionProgramaModule } from './institucion-programa/institucion-pr
|
||||
import { InstitucionTipoCarritoModule } from './institucion-tipo-carrito/institucion-tipo-carrito.module';
|
||||
import { InstitucionTipoEntradaModule } from './institucion-tipo-entrada/institucion-tipo-entrada.module';
|
||||
import { InstitucionUsuarioModule } from './institucion-usuario/institucion-usuario.module';
|
||||
import { MarcaModule } from './marca/marca.module';
|
||||
import { ModeloModule } from './modelo/modelo.module';
|
||||
import { ModuloModule } from './modulo/modulo.module';
|
||||
import { MotivoModule } from './motivo/motivo.module';
|
||||
@ -26,6 +31,7 @@ import { MultaModule } from './multa/multa.module';
|
||||
import { NodemailerModule } from './nodemailer/nodemailer.module';
|
||||
import { OperadorModule } from './operador/operador.module';
|
||||
import { PrestamoModule } from './prestamo/prestamo.module';
|
||||
import { SoapClientModule } from './soap-client/soap-client.module';
|
||||
import { StatusModule } from './status/status.module';
|
||||
import { TipoUsuarioModule } from './tipo-usuario/tipo-usuario.module';
|
||||
import { UploadFileModule } from './upload-file/upload-file.module';
|
||||
@ -62,12 +68,21 @@ import { TipoCarrito } from './institucion-tipo-carrito/entity/tipo-carrito.enti
|
||||
import { TipoEntrada } from './institucion-tipo-entrada/entity/tipo-entrada.entity';
|
||||
import { TipoUsuario } from './tipo-usuario/entity/tipo-usuario.entity';
|
||||
import { Usuario } from './usuario/entity/usuario.entity';
|
||||
import { SoapClientModule } from './soap-client/soap-client.module';
|
||||
import { MarcaModule } from './marca/marca.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ConfigModule.forRoot({ isGlobal: true }),
|
||||
GoogleRecaptchaModule.forRootAsync({
|
||||
inject: [ConfigService],
|
||||
useFactory: (configService: ConfigService) => {
|
||||
return {
|
||||
secretKey: configService.get<string>('GOOGLE_RECAPTCHA_KEY'),
|
||||
response: (req) => req.headers.recaptcha,
|
||||
skipIf: configService.get<string>('STATE') !== 'produccion',
|
||||
network: GoogleRecaptchaNetwork.Recaptcha,
|
||||
};
|
||||
},
|
||||
}),
|
||||
TypeOrmModule.forRootAsync({
|
||||
inject: [ConfigService],
|
||||
useFactory: (configService: ConfigService) => {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Body, Controller, Get, Post, UseGuards } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { ApiBody, ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||
import { Recaptcha } from '@nestlab/google-recaptcha';
|
||||
import { Serealize } from '../interceptors/serialize.interceptor';
|
||||
import { AuthService } from './auth.service';
|
||||
import { LoginAdminDto } from './dto/input/login-admin.dto';
|
||||
@ -15,6 +16,7 @@ export class AuthController {
|
||||
constructor(private authService: AuthService) {}
|
||||
|
||||
@Serealize(AuthOperadorOutputDto)
|
||||
@Recaptcha()
|
||||
@Post('login-admin')
|
||||
@ApiOperation({
|
||||
description: 'Endpoint utilizado para el login del panel admin.',
|
||||
@ -35,6 +37,7 @@ export class AuthController {
|
||||
}
|
||||
|
||||
@Serealize(AuthOperadorOutputDto)
|
||||
@Recaptcha()
|
||||
@Post('login-operador')
|
||||
@ApiOperation({
|
||||
description: 'Endpoint utilizado para el login del panel del operador.',
|
||||
@ -60,6 +63,7 @@ export class AuthController {
|
||||
}
|
||||
|
||||
@Serealize(AuthUsuarioOutputDto)
|
||||
@Recaptcha()
|
||||
@Post('login-usuario')
|
||||
@ApiOperation({
|
||||
description: 'Endpoint utilizado para el login del usuario.',
|
||||
|
Loading…
Reference in New Issue
Block a user