forked from midou/invidious
Login redirect to referer on logged-in user (#3556)
This commit is contained in:
commit
6c687a3cac
@ -259,7 +259,7 @@ def get_referer(env, fallback = "/", unroll = true)
|
|||||||
end
|
end
|
||||||
|
|
||||||
referer = referer.request_target
|
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
|
if referer == env.request.path
|
||||||
referer = fallback
|
referer = fallback
|
||||||
|
@ -203,7 +203,7 @@ module Invidious::Routes::Account
|
|||||||
referer = get_referer(env)
|
referer = get_referer(env)
|
||||||
|
|
||||||
if !user
|
if !user
|
||||||
return env.redirect referer
|
return env.redirect "/login?referer=#{URI.encode_path_segment(env.request.resource)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
user = user.as(User)
|
user = user.as(User)
|
||||||
|
@ -6,14 +6,14 @@ module Invidious::Routes::Login
|
|||||||
|
|
||||||
user = env.get? "user"
|
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
|
if !CONFIG.login_enabled
|
||||||
return error_template(400, "Login has been disabled by administrator.")
|
return error_template(400, "Login has been disabled by administrator.")
|
||||||
end
|
end
|
||||||
|
|
||||||
referer = get_referer(env, "/feed/subscriptions")
|
|
||||||
|
|
||||||
email = nil
|
email = nil
|
||||||
password = nil
|
password = nil
|
||||||
captcha = nil
|
captcha = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user