diff options
author | Patrick Cloke <patrickc@matrix.org> | 2020-07-02 10:55:41 -0400 |
---|---|---|
committer | Patrick Cloke <patrickc@matrix.org> | 2020-07-02 10:55:41 -0400 |
commit | 4d978d7db4448e3cb526ee1087aeab578a31ac71 (patch) | |
tree | 872c47b3fb4843e720b4c785cbcb9e87a95779ae /synapse/rest/client/v2_alpha/register.py | |
parent | Hack to add push priority to push notifications (#7765) (diff) | |
parent | Merge tag 'v1.15.2' (diff) | |
download | synapse-4d978d7db4448e3cb526ee1087aeab578a31ac71.tar.xz |
Merge branch 'master' into develop
Diffstat (limited to 'synapse/rest/client/v2_alpha/register.py')
-rw-r--r-- | synapse/rest/client/v2_alpha/register.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py index 141a3f5fac..56a451c42f 100644 --- a/synapse/rest/client/v2_alpha/register.py +++ b/synapse/rest/client/v2_alpha/register.py @@ -36,7 +36,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, @@ -304,17 +304,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): |