From 29f03966ec3746f8a76e516ceacbe2eac252a8d2 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Thu, 26 Mar 2020 00:42:37 -0300 Subject: [PATCH] =?UTF-8?q?Fix:=202FA=20DDP=20method=20not=20getting=20cod?= =?UTF-8?q?e=20on=20API=20call=20that=20doesn=E2=80=99t=20requires=202FA?= =?UTF-8?q?=20(#16998)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/2fa/server/code/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/2fa/server/code/index.ts b/app/2fa/server/code/index.ts index 233e86dded59..cdc12e6520ab 100644 --- a/app/2fa/server/code/index.ts +++ b/app/2fa/server/code/index.ts @@ -120,6 +120,11 @@ function _checkCodeForUser({ user, code, method, options = {}, connection }: ICh user = getUserForCheck(user); } + if (!code && !method && connection?.httpHeaders?.['x-2fa-code'] && connection.httpHeaders['x-2fa-method']) { + code = connection.httpHeaders['x-2fa-code']; + method = connection.httpHeaders['x-2fa-method']; + } + if (connection && isAuthorizedForToken(connection, user, options)) { return true; }