This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Send password reset from HS: Sending the email #5345
Merged
anoadragon453
merged 33 commits into
anoa/feature_hs_password_resets
from
anoa/hs_password_reset_sending_email
Jun 6, 2019
+452
−57
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
dbdebc2
Ability to send password reset emails
anoadragon453 9567c60
Merge branch 'develop' into anoa/hs_password_reset_sending_email
anoadragon453 ed35302
Fix validation token lifetime email_ prefix
anoadragon453 094c351
Add changelog
anoadragon453 899219c
Update manifest to include txt/html template files
anoadragon453 309943f
Update db
anoadragon453 354d749
mark jinja2 and bleach as required dependencies
anoadragon453 62e1ec0
Add email settings to default unit test config
anoadragon453 a0e2a10
Update unit test template dir
anoadragon453 a862f2a
gen sample config
anoadragon453 752dbee
Merge branch 'anoa/feature_hs_password_resets' into anoa/hs_password_…
anoadragon453 177f024
Add html5lib as a required dep
anoadragon453 6d2d3c9
Modify check for smtp settings to be kinder to CI
anoadragon453 6394715
silly linting rules
anoadragon453 fe0af29
Correct html5lib dep version number
anoadragon453 91eac88
one more time
anoadragon453 c9573ca
Change template_dir to originate from synapse root dir
anoadragon453 4c406f5
Revert "Modify check for smtp settings to be kinder to CI"
anoadragon453 70b161d
Move templates. New option to disable password resets
anoadragon453 79bc668
Update templates and make password reset option work
anoadragon453 f522cde
Change jinja2 and bleach back to opt deps
anoadragon453 a4c0907
Update email condition requirement
anoadragon453 efa1a56
Only import jinja2/bleach if we need it
anoadragon453 6a9588c
Update sample config
anoadragon453 78ca92a
Revert manifest changes for new res directory
anoadragon453 12ed769
Remove public_baseurl from unittest config
anoadragon453 6efb301
infer ability to reset password from email config
anoadragon453 3478213
Address review comments
anoadragon453 a37a2f1
regen sample config
anoadragon453 cd4f4a2
test for ci
anoadragon453 92090d3
Remove CI test
anoadragon453 7168dee
fix bug?
anoadragon453 828cdbb
Run bg update on the master process
anoadragon453 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
infer ability to reset password from email config
commit 6efb301e056b5d4644dbeac556ef595bd8615f1f
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -77,6 +77,14 @@ def read_config(self, 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: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
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, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, should be in milliseconds for consistency |
||||||
|
@@ -206,7 +214,7 @@ def _get_template_content(self, template_dir, path): | |||||
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 | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this just
self.enable_password_resets = self.email_enable_password_reset_from_is or email_config != {}
?