Minor decorator fix.

master
voussoir 2023-06-25 21:13:52 -07:00
parent 3c505e1244
commit e1c47e8bf6
2 changed files with 9 additions and 2 deletions

View File

@ -99,8 +99,11 @@ def before_request():
if site.localhost_only and not request.is_localhost: if site.localhost_only and not request.is_localhost:
return flask.abort(403) return flask.abort(403)
# Since we don't define this route, I can't just add this where it belongs. if request.url_rule is None:
# Sorry. return flask.abort(404)
# Since we don't define this route (/static/ is a default from flask),
# I can't just add this where it belongs. Sorry.
if request.url_rule.rule == '/static/<path:filename>': if request.url_rule.rule == '/static/<path:filename>':
permission_manager.global_public() permission_manager.global_public()

View File

@ -63,6 +63,10 @@ class SessionManager:
# Send the token back to the client # Send the token back to the client
# but only if the endpoint didn't manually set the cookie. # but only if the endpoint didn't manually set the cookie.
function_cookies = response.headers.get_all('Set-Cookie') function_cookies = response.headers.get_all('Set-Cookie')
if not hasattr(request, 'session') or not request.session:
return response
if not any('etiquette_session=' in cookie for cookie in function_cookies): if not any('etiquette_session=' in cookie for cookie in function_cookies):
response.set_cookie( response.set_cookie(
'etiquette_session', 'etiquette_session',