Add 2fa to token auth endpoint

This commit is contained in:
syeopite 2021-07-15 02:32:53 -07:00
parent 7cfee1dc94
commit 79daa920e1
No known key found for this signature in database
GPG key ID: 6FA616E5A5294A82

View file

@ -1036,6 +1036,11 @@ get "/authorize_token" do |env|
user = user.as(User) user = user.as(User)
sid = sid.as(String) sid = sid.as(String)
if user.totp_secret && env.request.cookies["2faVerified"]?.try &.value != "1" || nil
next call_totp_validator(env, user, sid, locale)
end
csrf_token = generate_response(sid, {":authorize_token"}, HMAC_KEY, PG_DB) csrf_token = generate_response(sid, {":authorize_token"}, HMAC_KEY, PG_DB)
scopes = env.params.query["scopes"]?.try &.split(",") scopes = env.params.query["scopes"]?.try &.split(",")