mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Add 2fa to change_password endpoint
This commit is contained in:
parent
71b5874380
commit
755b847ad5
2 changed files with 6 additions and 1 deletions
|
@ -858,6 +858,11 @@ get "/change_password" do |env|
|
|||
|
||||
user = user.as(User)
|
||||
sid = sid.as(String)
|
||||
if user.totp_secret && env.response.cookies["2faVerified"]?.try &.value != "1" || nil
|
||||
csrf_token = generate_response(sid, {":validate_2fa"}, HMAC_KEY, PG_DB)
|
||||
next templated "account/validate_2fa?referer=#{env.get?("current_page")}"
|
||||
end
|
||||
|
||||
csrf_token = generate_response(sid, {":change_password"}, HMAC_KEY, PG_DB)
|
||||
|
||||
templated "account/change_password"
|
||||
|
|
|
@ -27,7 +27,7 @@ class Invidious::Routes::Accounts < Invidious::Routes::BaseRoute
|
|||
|
||||
user = env.get? "user"
|
||||
sid = env.get? "sid"
|
||||
referer = get_referer(env)
|
||||
referer = get_referer(env, unroll: false)
|
||||
|
||||
if !user
|
||||
return env.redirect referer
|
||||
|
|
Loading…
Reference in a new issue