FIX: terms of use dynamic language

This commit is contained in:
Gabriel Rosa
2022-10-10 19:56:57 -03:00
parent 5a2c760bab
commit 62730eb969
3 changed files with 14 additions and 5 deletions
+8 -3
View File
@@ -27,6 +27,7 @@ import { AuthClientService } from './auth.service';
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
import { GrpcToHttpExceptionFilter } from '../../error/grpc-to-http-exception.filter';
import { RequestUser, User } from 'src/authentication/user.decorator';
import { Metadata } from '@grpc/grpc-js';
@ApiTags('Auth')
@UseFilters(new GrpcToHttpExceptionFilter())
@@ -59,10 +60,14 @@ export class AuthController {
@Post('sign-in')
@HttpCode(HttpStatus.OK)
async signIn(@Body() { username, password, totp }: AuthSignInRequest) {
async signIn(
@Body() { username, password, totp }: AuthSignInRequest,
@Headers('Dadosfera-Lang') language: string,
) {
this.logger.info('/auth - SignIn');
return this.authClient.signIn({ username, password, totp });
const metadata = new Metadata();
metadata.add('language', language || 'pt-br');
return this.authClient.signIn({ username, password, totp }, metadata);
}
@Post('refresh-access-token')
+5 -1
View File
@@ -19,6 +19,7 @@ import {
AuthConfirmResetPasswordRequest,
} from '@dadosfera/protospack-v2/dist/lib/Duc/interfaces/messages';
import { DucClient } from '../duc/client.config';
import { Metadata } from '@grpc/grpc-js';
@Injectable()
export class AuthClientService implements OnModuleInit {
@@ -51,7 +52,10 @@ export class AuthClientService implements OnModuleInit {
return lastValueFrom(this.authService.AuthSnowflakeSignIn(input));
}
async signIn({ username, password, totp }: AuthSignInRequest) {
async signIn(
{ username, password, totp }: AuthSignInRequest,
metadata: Metadata,
) {
this.logger.info('SignIn');
return lastValueFrom(
+1 -1
View File
File diff suppressed because one or more lines are too long