mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 11:25:29 -04:00
Fix incorrect login redirect (#64)
This commit is contained in:
parent
a0e5a03052
commit
5cd6f3eacb
@ -63,7 +63,10 @@ class AuthHandler < Kemal::Handler
|
||||
end
|
||||
|
||||
def handle_auth(env)
|
||||
return call_next(env) if request_path_startswith env, ["/login", "/logout"]
|
||||
if request_path_startswith env, ["/login", "/logout"] ||
|
||||
requesting_static_file env
|
||||
return call_next(env)
|
||||
end
|
||||
|
||||
unless validate_token env
|
||||
env.session.string "callback", env.request.path
|
||||
|
@ -16,10 +16,8 @@ class FS
|
||||
end
|
||||
|
||||
class StaticHandler < Kemal::Handler
|
||||
@dirs = ["/css", "/js", "/img", "/favicon.ico"]
|
||||
|
||||
def call(env)
|
||||
if request_path_startswith env, @dirs
|
||||
if requesting_static_file env
|
||||
file = FS.get? env.request.path
|
||||
return call_next env if file.nil?
|
||||
|
||||
|
@ -2,6 +2,11 @@ require "big"
|
||||
|
||||
IMGS_PER_PAGE = 5
|
||||
UPLOAD_URL_PREFIX = "/uploads"
|
||||
STATIC_DIRS = ["/css", "/js", "/img", "/favicon.ico"]
|
||||
|
||||
def requesting_static_file(env)
|
||||
request_path_startswith env, STATIC_DIRS
|
||||
end
|
||||
|
||||
macro layout(name)
|
||||
base_url = Config.current.base_url
|
||||
|
Loading…
x
Reference in New Issue
Block a user