Skip to content
Snippets Groups Projects
Unverified Commit b13cac89 authored by Andrew Morgan's avatar Andrew Morgan Committed by GitHub
Browse files

Fix up password reset template config names (#5863)

Fixes #5833

The emailconfig code was attempting to pull incorrect config file names. This corrects that, while also marking a difference between a config file variable that's a filepath versus a str containing HTML.
parent ce5f1cb9
No related branches found
No related tags found
No related merge requests found
Fix Synapse looking for config options `password_reset_failure_template` and `password_reset_success_template`, when they are actually `password_reset_template_failure_html`, `password_reset_template_success_html`.
...@@ -132,21 +132,21 @@ class EmailConfig(Config): ...@@ -132,21 +132,21 @@ class EmailConfig(Config):
self.email_password_reset_template_text = email_config.get( self.email_password_reset_template_text = email_config.get(
"password_reset_template_text", "password_reset.txt" "password_reset_template_text", "password_reset.txt"
) )
self.email_password_reset_failure_template = email_config.get( self.email_password_reset_template_failure_html = email_config.get(
"password_reset_failure_template", "password_reset_failure.html" "password_reset_template_failure_html", "password_reset_failure.html"
) )
# This template does not support any replaceable variables, so we will # This template does not support any replaceable variables, so we will
# read it from the disk once during setup # read it from the disk once during setup
email_password_reset_success_template = email_config.get( email_password_reset_template_success_html = email_config.get(
"password_reset_success_template", "password_reset_success.html" "password_reset_template_success_html", "password_reset_success.html"
) )
# Check templates exist # Check templates exist
for f in [ for f in [
self.email_password_reset_template_html, self.email_password_reset_template_html,
self.email_password_reset_template_text, self.email_password_reset_template_text,
self.email_password_reset_failure_template, self.email_password_reset_template_failure_html,
email_password_reset_success_template, email_password_reset_template_success_html,
]: ]:
p = os.path.join(self.email_template_dir, f) p = os.path.join(self.email_template_dir, f)
if not os.path.isfile(p): if not os.path.isfile(p):
...@@ -154,9 +154,9 @@ class EmailConfig(Config): ...@@ -154,9 +154,9 @@ class EmailConfig(Config):
# Retrieve content of web templates # Retrieve content of web templates
filepath = os.path.join( filepath = os.path.join(
self.email_template_dir, email_password_reset_success_template self.email_template_dir, email_password_reset_template_success_html
) )
self.email_password_reset_success_html_content = self.read_file( self.email_password_reset_template_success_html_content = self.read_file(
filepath, "email.password_reset_template_success_html" filepath, "email.password_reset_template_success_html"
) )
......
...@@ -282,13 +282,13 @@ class PasswordResetSubmitTokenServlet(RestServlet): ...@@ -282,13 +282,13 @@ class PasswordResetSubmitTokenServlet(RestServlet):
return None return None
# Otherwise show the success template # Otherwise show the success template
html = self.config.email_password_reset_success_html_content html = self.config.email_password_reset_template_success_html_content
request.setResponseCode(200) request.setResponseCode(200)
except ThreepidValidationError as e: except ThreepidValidationError as e:
# Show a failure page with a reason # Show a failure page with a reason
html = self.load_jinja2_template( html = self.load_jinja2_template(
self.config.email_template_dir, self.config.email_template_dir,
self.config.email_password_reset_failure_template, self.config.email_password_reset_template_failure_html,
template_vars={"failure_reason": e.msg}, template_vars={"failure_reason": e.msg},
) )
request.setResponseCode(e.code) request.setResponseCode(e.code)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment