From 9a615ac1af7c29332650386620f78a55d340d980 Mon Sep 17 00:00:00 2001 From: syeopite Date: Thu, 15 Jul 2021 02:32:53 -0700 Subject: [PATCH] Add 2fa to token auth endpoint --- src/invidious/routes/account.cr | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/invidious/routes/account.cr b/src/invidious/routes/account.cr index e69f118a..23101eed 100644 --- a/src/invidious/routes/account.cr +++ b/src/invidious/routes/account.cr @@ -207,6 +207,11 @@ module Invidious::Routes::Account user = env.get? "user" sid = env.get? "sid" + + if user.totp_secret && env.request.cookies["2faVerified"]?.try &.value != "1" || nil + return call_totp_validator(env, user, sid, locale) + end + referer = get_referer(env) if !user