mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 14:04:20 +01:00
Fix subdirectory deployments in a generic manner (#802)
* Fix subdirectory deployments in a generic manner by modifying`request.path` to combine both `request.script_root` and `request.path` and also creating a request preprocessor to redirect users into the true CTFd app. Without this sessions will be invalid because sessions will be set to a subdirectory. * Add a test for testing subdirectory deployments and the customized CTFdRequest object. * Fix `TestingConfig.SAFE_MODE` getting stuck in between tests. * Order AWS keys properly in travis.yml * Redirect to `request.full_path` instead of just `request.path`
This commit is contained in:
@@ -20,9 +20,13 @@ else:
|
||||
FakeRequest = namedtuple('FakeRequest', ['form'])
|
||||
|
||||
|
||||
def create_ctfd(ctf_name="CTFd", name="admin", email="admin@ctfd.io", password="password", user_mode="users", setup=True, enable_plugins=False):
|
||||
def create_ctfd(ctf_name="CTFd", name="admin", email="admin@ctfd.io", password="password", user_mode="users", setup=True, enable_plugins=False, application_root='/'):
|
||||
if enable_plugins:
|
||||
TestingConfig.SAFE_MODE = False
|
||||
else:
|
||||
TestingConfig.SAFE_MODE = True
|
||||
|
||||
TestingConfig.APPLICATION_ROOT = application_root
|
||||
|
||||
app = create_app(TestingConfig)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user