From b8c24880b1b81e787b07c4e0e6d1f2a54d9bc6fb Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 15 Aug 2019 14:26:44 +0100 Subject: [PATCH 1/3] Fix up password reset template config names --- synapse/config/emailconfig.py | 16 ++++++++-------- synapse/rest/client/v2_alpha/account.py | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/synapse/config/emailconfig.py b/synapse/config/emailconfig.py index 8381b8eb296d..36d01a10af70 100644 --- a/synapse/config/emailconfig.py +++ b/synapse/config/emailconfig.py @@ -132,21 +132,21 @@ def read_config(self, config, **kwargs): self.email_password_reset_template_text = email_config.get( "password_reset_template_text", "password_reset.txt" ) - self.email_password_reset_failure_template = email_config.get( - "password_reset_failure_template", "password_reset_failure.html" + self.email_password_reset_template_failure_html = email_config.get( + "password_reset_template_failure_html", "password_reset_failure.html" ) # This template does not support any replaceable variables, so we will # read it from the disk once during setup - email_password_reset_success_template = email_config.get( - "password_reset_success_template", "password_reset_success.html" + email_password_reset_template_success_html = email_config.get( + "password_reset_template_success_html", "password_reset_success.html" ) # Check templates exist for f in [ self.email_password_reset_template_html, self.email_password_reset_template_text, - self.email_password_reset_failure_template, - email_password_reset_success_template, + self.email_password_reset_template_failure_html, + email_password_reset_template_success_html, ]: p = os.path.join(self.email_template_dir, f) if not os.path.isfile(p): @@ -154,9 +154,9 @@ def read_config(self, config, **kwargs): # Retrieve content of web templates 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" ) diff --git a/synapse/rest/client/v2_alpha/account.py b/synapse/rest/client/v2_alpha/account.py index 7ac456812a12..934ed5d16d1f 100644 --- a/synapse/rest/client/v2_alpha/account.py +++ b/synapse/rest/client/v2_alpha/account.py @@ -282,13 +282,13 @@ def on_GET(self, request, medium): return None # 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) except ThreepidValidationError as e: # Show a failure page with a reason html = self.load_jinja2_template( 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}, ) request.setResponseCode(e.code) From bee7b447321e42e51a175c823887b9787412b202 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 15 Aug 2019 14:31:06 +0100 Subject: [PATCH 2/3] Add changelog --- changelog.d/5863.bugfix | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog.d/5863.bugfix diff --git a/changelog.d/5863.bugfix b/changelog.d/5863.bugfix new file mode 100644 index 000000000000..53397f99ca1d --- /dev/null +++ b/changelog.d/5863.bugfix @@ -0,0 +1,3 @@ +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`. \ No newline at end of file From 61ac82889e0e161b07ad5426372de716abcb577a Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 15 Aug 2019 16:05:10 +0100 Subject: [PATCH 3/3] Update changelog to be on one line --- changelog.d/5863.bugfix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/changelog.d/5863.bugfix b/changelog.d/5863.bugfix index 53397f99ca1d..bceae5be671d 100644 --- a/changelog.d/5863.bugfix +++ b/changelog.d/5863.bugfix @@ -1,3 +1 @@ -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`. \ No newline at end of file +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`.