From 658b678d8030dbbfa14d1ed560caec4d16f0aa6d Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Thu, 18 Jul 2024 20:57:59 +0300 Subject: [PATCH] ws: send auth-deny and reload page --- apps/api/src/ldap-tfa/ldap-tfa.controller.ts | 4 +++- apps/web/components/Form/hooks/telegram.ts | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/api/src/ldap-tfa/ldap-tfa.controller.ts b/apps/api/src/ldap-tfa/ldap-tfa.controller.ts index 1a914e4..e23bf0b 100644 --- a/apps/api/src/ldap-tfa/ldap-tfa.controller.ts +++ b/apps/api/src/ldap-tfa/ldap-tfa.controller.ts @@ -98,7 +98,9 @@ export class LdapTfaController extends LdapController { status: HttpStatus.OK, }) @UsePipes(new ValidationPipe({ transform: true })) - async telegramReject(@Query() _query: TelegramDto, @Res() reply: FastifyReply) { + async telegramReject(@Query() query: TelegramDto, @Res() reply: FastifyReply) { + this.ldapTfaGateway.notify('auth-deny', query); + return reply.status(200).send({ success: true }); } diff --git a/apps/web/components/Form/hooks/telegram.ts b/apps/web/components/Form/hooks/telegram.ts index 89a666d..617cdf4 100644 --- a/apps/web/components/Form/hooks/telegram.ts +++ b/apps/web/components/Form/hooks/telegram.ts @@ -87,6 +87,11 @@ export function useTelegramConfirm() { }) ); }); + + socket.on('auth-deny', () => { + socket.off('connect'); + window.location.reload(); + }); } return () => {