Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix up password reset template config names (#5863)
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Feb 20, 2020
2 parents 7a9236a + b13cac8 commit 6cb514c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
9 changes: 4 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,11 @@ If Synapse is not configured with an SMTP server, password reset via email will

## Registering a user

You will need at least one user on your server in order to use a Matrix
client. Users can be registered either via a Matrix client, or via a
commandline script.
The easiest way to create a new user is to do so from a client like [Riot](https://riot.im).

To get started, it is easiest to use the command line to register new
users. This can be done as follows:
Alternatively you can do so from the command line if you have installed via pip.

This can be done as follows:

```
$ source ~/synapse/env/bin/activate
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5863.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +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`.
16 changes: 8 additions & 8 deletions synapse/config/emailconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,31 +132,31 @@ 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):
raise ConfigError("Unable to find template file %s" % (p,))

# 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"
)

Expand Down
4 changes: 2 additions & 2 deletions synapse/rest/client/v2_alpha/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,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)
Expand Down

0 comments on commit 6cb514c

Please sign in to comment.