Move templates. New option to disable password resets

This commit is contained in:
Andrew Morgan 2019-06-05 16:36:02 +01:00
parent 4c406f5afc
commit 70b161decc
5 changed files with 16 additions and 22 deletions

View file

@ -1,9 +0,0 @@
<html>
<body>
<p>here's the link you forgetful person you!</p>
<a href="{{ link }}">Reset your password</a>
<p>now get on back to happy town!</p>
</body>
</html>

View file

@ -1,5 +0,0 @@
here's the link you forgetful person you!
{{ link }}
now get on back to happy town!

View file

@ -64,7 +64,7 @@ class EmailConfig(Config):
# work for the same reason.) # work for the same reason.)
if not template_dir: if not template_dir:
template_dir = pkg_resources.resource_filename( template_dir = pkg_resources.resource_filename(
'synapse', '../res/templates' 'synapse', 'res/templates'
) )
self.email_template_dir = os.path.abspath(template_dir) self.email_template_dir = os.path.abspath(template_dir)
@ -94,7 +94,7 @@ class EmailConfig(Config):
jinja2 jinja2
bleach bleach
if not self.email_enable_password_reset_from_is: if self.allow_password_resets and not self.email_enable_password_reset_from_is:
required = [ required = [
"smtp_host", "smtp_host",
"smtp_port", "smtp_port",

View file

@ -21,6 +21,8 @@ class PasswordConfig(Config):
""" """
def read_config(self, config): def read_config(self, config):
self.allow_password_resets = config.get("allow_password_resets", False)
password_config = config.get("password_config", {}) password_config = config.get("password_config", {})
if password_config is None: if password_config is None:
password_config = {} password_config = {}
@ -30,6 +32,18 @@ class PasswordConfig(Config):
def default_config(self, config_dir_path, server_name, **kwargs): def default_config(self, config_dir_path, server_name, **kwargs):
return """\ return """\
# Allow users to reset their password
#
# Resetting a user's password is done either by sending a token from
# Synapse, or asking an identity server to do so. In Synapse v1.0,
# sending a password reset token from an identity server was turned off
# by default for security reasons.
#
# If enable_password_reset_from_is is False, you must fill out the
# "email" section of the config before enabling password resets
#
#allow_password_resets: False
password_config: password_config:
# Uncomment to disable password login # Uncomment to disable password login
# #

View file

@ -131,12 +131,6 @@ def default_config(name, parse=False):
"password_providers": [], "password_providers": [],
"worker_replication_url": "", "worker_replication_url": "",
"worker_app": None, "worker_app": None,
"email": {
"enable_notifs": False,
"smtp_host": "somehost",
"smtp_port": 25,
"notif_from": "someone <someone@example.com>",
},
"block_non_admin_invites": False, "block_non_admin_invites": False,
"federation_domain_whitelist": None, "federation_domain_whitelist": None,
"filter_timeline_limit": 5000, "filter_timeline_limit": 5000,