mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-12-04 07:05:35 +00:00
Fixing access to assets #3053
This commit is contained in:
@@ -228,7 +228,7 @@ def changedetection_app(config=None, datastore_o=None):
|
||||
|
||||
if has_password_enabled and not flask_login.current_user.is_authenticated:
|
||||
# Permitted
|
||||
if request.endpoint and 'static_content' in request.endpoint and request.view_args and request.view_args.get('group') == 'styles':
|
||||
if request.endpoint and request.endpoint == 'static_content' and request.view_args and request.view_args.get('group') in ['styles', 'js', 'images', 'favicons']:
|
||||
return None
|
||||
# Permitted
|
||||
elif request.endpoint and 'login' in request.endpoint:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from .util import live_server_setup
|
||||
from .util import live_server_setup, wait_for_all_checks
|
||||
from flask import url_for
|
||||
import time
|
||||
|
||||
@@ -52,6 +52,14 @@ def test_check_access_control(app, client, live_server):
|
||||
res = c.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
|
||||
assert b'Random content' in res.data
|
||||
|
||||
# access to assets should work (check_authentication)
|
||||
res = c.get(url_for('static_content', group='js', filename='jquery-3.6.0.min.js'))
|
||||
assert res.status_code == 200
|
||||
res = c.get(url_for('static_content', group='styles', filename='styles.css'))
|
||||
assert res.status_code == 200
|
||||
res = c.get(url_for('static_content', group='styles', filename='404-testetest.css'))
|
||||
assert res.status_code == 404
|
||||
|
||||
# Check wrong password does not let us in
|
||||
res = c.post(
|
||||
url_for("login"),
|
||||
|
||||
Reference in New Issue
Block a user