mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-18 17:10:43 +03:00
infer ability to reset password from email config
This commit is contained in:
parent
12ed769fbf
commit
6efb301e05
3 changed files with 10 additions and 28 deletions
|
@ -1006,18 +1006,6 @@ signing_key_path: "CONFDIR/SERVERNAME.signing.key"
|
|||
# algorithm: "HS256"
|
||||
|
||||
|
||||
# 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
|
||||
#
|
||||
#enable_password_resets: False
|
||||
|
||||
password_config:
|
||||
# Uncomment to disable password login
|
||||
#
|
||||
|
@ -1031,7 +1019,7 @@ password_config:
|
|||
|
||||
|
||||
# Enable sending emails for password resets, notification events or
|
||||
# account expiry notices
|
||||
# account expiry notices.
|
||||
#
|
||||
# If your SMTP server requires authentication, the optional smtp_user &
|
||||
# smtp_pass variables should be used
|
||||
|
|
|
@ -77,6 +77,14 @@ class EmailConfig(Config):
|
|||
self.email_enable_password_reset_from_is = email_config.get(
|
||||
"enable_password_reset_from_is", False,
|
||||
)
|
||||
self.enable_password_resets = (
|
||||
self.email_enable_password_reset_from_is
|
||||
or (not self.email_enable_password_reset_from_is and email_config != {})
|
||||
)
|
||||
if email_config == {} and not self.email_enable_password_reset_from_is:
|
||||
logger.warn(
|
||||
"User password resets have been disabled due to lack of email config."
|
||||
)
|
||||
|
||||
self.email_validation_token_lifetime = email_config.get(
|
||||
"validation_token_lifetime", 15 * 60,
|
||||
|
@ -206,7 +214,7 @@ class EmailConfig(Config):
|
|||
def default_config(self, config_dir_path, server_name, **kwargs):
|
||||
return """
|
||||
# Enable sending emails for password resets, notification events or
|
||||
# account expiry notices
|
||||
# account expiry notices.
|
||||
#
|
||||
# If your SMTP server requires authentication, the optional smtp_user &
|
||||
# smtp_pass variables should be used
|
||||
|
|
|
@ -21,8 +21,6 @@ class PasswordConfig(Config):
|
|||
"""
|
||||
|
||||
def read_config(self, config):
|
||||
self.enable_password_resets = config.get("enable_password_resets", False)
|
||||
|
||||
password_config = config.get("password_config", {})
|
||||
if password_config is None:
|
||||
password_config = {}
|
||||
|
@ -32,18 +30,6 @@ class PasswordConfig(Config):
|
|||
|
||||
def default_config(self, config_dir_path, server_name, **kwargs):
|
||||
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
|
||||
#
|
||||
#enable_password_resets: False
|
||||
|
||||
password_config:
|
||||
# Uncomment to disable password login
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue