feat: prevent passthrough, because it sends an error
This commit is contained in:
parent
9724b127c8
commit
795fdd6b3f
|
|
@ -41,7 +41,7 @@ export class AuthController {
|
||||||
async register(
|
async register(
|
||||||
@Req() req: Request,
|
@Req() req: Request,
|
||||||
@Body() body: CreateOrgUserDto,
|
@Body() body: CreateOrgUserDto,
|
||||||
@Res({ passthrough: true }) response: Response,
|
@Res({ passthrough: false }) response: Response,
|
||||||
@RealIP() ip: string,
|
@RealIP() ip: string,
|
||||||
@UserAgent() userAgent: string
|
@UserAgent() userAgent: string
|
||||||
) {
|
) {
|
||||||
|
|
@ -114,7 +114,7 @@ export class AuthController {
|
||||||
async login(
|
async login(
|
||||||
@Req() req: Request,
|
@Req() req: Request,
|
||||||
@Body() body: LoginUserDto,
|
@Body() body: LoginUserDto,
|
||||||
@Res({ passthrough: true }) response: Response,
|
@Res({ passthrough: false }) response: Response,
|
||||||
@RealIP() ip: string,
|
@RealIP() ip: string,
|
||||||
@UserAgent() userAgent: string
|
@UserAgent() userAgent: string
|
||||||
) {
|
) {
|
||||||
|
|
@ -204,11 +204,11 @@ export class AuthController {
|
||||||
@Post('/activate')
|
@Post('/activate')
|
||||||
async activate(
|
async activate(
|
||||||
@Body('code') code: string,
|
@Body('code') code: string,
|
||||||
@Res({ passthrough: true }) response: Response
|
@Res({ passthrough: false }) response: Response
|
||||||
) {
|
) {
|
||||||
const activate = await this._authService.activate(code);
|
const activate = await this._authService.activate(code);
|
||||||
if (!activate) {
|
if (!activate) {
|
||||||
return response.status(200).send({ can: false });
|
return response.status(200).json({ can: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
response.cookie('auth', activate, {
|
response.cookie('auth', activate, {
|
||||||
|
|
@ -228,16 +228,18 @@ export class AuthController {
|
||||||
}
|
}
|
||||||
|
|
||||||
response.header('onboarding', 'true');
|
response.header('onboarding', 'true');
|
||||||
return response.status(200).send({ can: true });
|
|
||||||
|
return response.status(200).json({ can: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post('/oauth/:provider/exists')
|
@Post('/oauth/:provider/exists')
|
||||||
async oauthExists(
|
async oauthExists(
|
||||||
@Body('code') code: string,
|
@Body('code') code: string,
|
||||||
@Param('provider') provider: string,
|
@Param('provider') provider: string,
|
||||||
@Res({ passthrough: true }) response: Response
|
@Res({ passthrough: false }) response: Response
|
||||||
) {
|
) {
|
||||||
const { jwt, token } = await this._authService.checkExists(provider, code);
|
const { jwt, token } = await this._authService.checkExists(provider, code);
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
return response.json({ token });
|
return response.json({ token });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue