Login redirect to referer on logged-in user

This commit is contained in:
Brahim Hadriche 2023-01-13 19:04:37 -05:00
parent 05258d56bd
commit 01acb9bfbf
2 changed files with 4 additions and 4 deletions

View file

@ -259,7 +259,7 @@ def get_referer(env, fallback = "/", unroll = true)
end
referer = referer.request_target
referer = "/" + referer.gsub(/[^\/?@&%=\-_.0-9a-zA-Z]/, "").lstrip("/\\")
referer = "/" + referer.gsub(/[^\/?@&%=\-_.:,0-9a-zA-Z]/, "").lstrip("/\\")
if referer == env.request.path
referer = fallback

View file

@ -6,14 +6,14 @@ module Invidious::Routes::Login
user = env.get? "user"
return env.redirect "/feed/subscriptions" if user
referer = get_referer(env, "/feed/subscriptions")
return env.redirect referer if user
if !CONFIG.login_enabled
return error_template(400, "Login has been disabled by administrator.")
end
referer = get_referer(env, "/feed/subscriptions")
email = nil
password = nil
captcha = nil