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:
Kevin Chung
2018-12-16 13:18:08 -05:00
committed by GitHub
parent f4f4bd5333
commit 324f8859a1
10 changed files with 119 additions and 16 deletions

View File

@@ -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)