Respect base url setting when redirecting

This commit is contained in:
Alex Ling
2020-05-23 10:42:59 +00:00
parent 8658cb8306
commit 60d4cee0a9
5 changed files with 14 additions and 9 deletions

View File

@@ -11,7 +11,7 @@ class AuthHandler < Kemal::Handler
cookie = env.request.cookies.find { |c| c.name == "token" }
if cookie.nil? || !@storage.verify_token cookie.value
return env.redirect "/login"
return redirect env, "/login"
end
if request_path_startswith env, ["/admin", "/api/admin", "/download"]