mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-27 01:00:32 -04:00
Ensure that HTML pages served from Synapse include headers to avoid embedding.
This commit is contained in:
parent
0fc5575c5b
commit
ea26e9a98b
10 changed files with 103 additions and 94 deletions
|
@ -38,7 +38,7 @@ from synapse.config.ratelimiting import FederationRateLimitConfig
|
|||
from synapse.config.registration import RegistrationConfig
|
||||
from synapse.config.server import is_threepid_reserved
|
||||
from synapse.handlers.auth import AuthHandler
|
||||
from synapse.http.server import finish_request
|
||||
from synapse.http.server import finish_request, respond_with_html
|
||||
from synapse.http.servlet import (
|
||||
RestServlet,
|
||||
assert_params_in_dict,
|
||||
|
@ -306,17 +306,15 @@ class RegistrationSubmitTokenServlet(RestServlet):
|
|||
|
||||
# Otherwise show the success template
|
||||
html = self.config.email_registration_template_success_html_content
|
||||
|
||||
request.setResponseCode(200)
|
||||
status_code = 200
|
||||
except ThreepidValidationError as e:
|
||||
request.setResponseCode(e.code)
|
||||
status_code = e.code
|
||||
|
||||
# Show a failure page with a reason
|
||||
template_vars = {"failure_reason": e.msg}
|
||||
html = self.failure_email_template.render(**template_vars)
|
||||
|
||||
request.write(html.encode("utf-8"))
|
||||
finish_request(request)
|
||||
respond_with_html(request, status_code, html)
|
||||
|
||||
|
||||
class UsernameAvailabilityRestServlet(RestServlet):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue