zulip/zerver
Alex Vandiver f00ff1ef62 middleware: Make HostDomain into a process_request, not process_response.
It is more suited for `process_request`, since it should stop
execution of the request if the domain is invalid.  This code was
likely added as a process_response (in ea39fb2556) because there was
already a process_response at the time (added 7e786d5426, and no
longer necessary since dce6b4a40f).

It quiets an unnecessary warning when logging in at a non-existent
realm.

This stops performing unnecessary work when we are going to throw it
away and return a 404.  The edge case to this is if the request
_creates_ a realm, and is made using the URL of the new realm; this
change would prevent the request before it occurs. While this does
arise in tests, the tests do not reflect reality -- real requests to
/accounts/register/ are made via POST to the same (default) realm,
redirected there from `confirm-preregistrationuser`.  The tests are
adjusted to reflect real behavior.

Tweaked by tabbott to add a block comment in HostDomainMiddleware.
2020-08-11 10:37:55 -07:00
..
data_import docs: Capitalize Markdown consistently. 2020-08-11 10:23:06 -07:00
lib docs: Capitalize Markdown consistently. 2020-08-11 10:23:06 -07:00
management docs: Correct “login” as a verb to “log in”. 2020-08-11 10:25:53 -07:00
migrations docs: Fix various capitalization errors. 2020-08-11 10:25:52 -07:00
openapi docs: Fix capitalization of keyboard keys. 2020-08-11 10:25:53 -07:00
templatetags docs: Fix various capitalization errors. 2020-08-11 10:25:52 -07:00
tests middleware: Make HostDomain into a process_request, not process_response. 2020-08-11 10:37:55 -07:00
tornado docs: Fix capitalization of keyboard keys. 2020-08-11 10:25:53 -07:00
views auth: Remove redirect on invalid realm during password reset. 2020-08-11 10:27:29 -07:00
webhooks docs: Capitalize Markdown consistently. 2020-08-11 10:23:06 -07:00
worker docs: Fix spelling errors caught by codespell. 2020-08-11 10:23:06 -07:00
__init__.py
apps.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
context_processors.py auth: Make apple log in and sign up buttons consistent with others. 2020-06-18 13:06:10 -07:00
decorator.py logging: Report stack_info on logging.exception calls. 2020-08-11 10:16:54 -07:00
filters.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
forms.py middleware: Make HostDomain into a process_request, not process_response. 2020-08-11 10:37:55 -07:00
logging_handlers.py docs: Capitalize Markdown consistently. 2020-08-11 10:23:06 -07:00
middleware.py middleware: Make HostDomain into a process_request, not process_response. 2020-08-11 10:37:55 -07:00
models.py docs: Capitalize Markdown consistently. 2020-08-11 10:23:06 -07:00
signals.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00