This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Couldn't load subscription status.
- Fork 2.1k
Allow HS to send emails when adding an email to the HS #6042
Merged
anoadragon453
merged 47 commits into
develop
from
anoa/account_3pid_homeserver_send_email
Sep 20, 2019
Merged
Changes from 43 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
0e5d92d
Allow HS to send emails when adding an email to the HS
anoadragon453 92b3246
Add changelog
anoadragon453 626ebbd
Add changelog
anoadragon453 8132107
Add 'add threepid' email templates to config. Gen sample config
anoadragon453 d309ea2
Merge branch 'develop' into anoa/account_3pid_homeserver
anoadragon453 112d55e
Merge branch 'anoa/account_3pid_homeserver' into anoa/account_3pid_ho…
anoadragon453 096808b
Add 3PID bind sytests to blacklist temporarily
anoadragon453 268bbbb
Prevent /account/3pid from binding to an identity server
anoadragon453 dda5137
Correct some small issues and fix bug
anoadragon453 8e2481b
Address review comments
anoadragon453 f6c0d5c
Remove the requirement for a medium argument
anoadragon453 923736f
Handle the homeserver disabling email validation
anoadragon453 4fc7796
Remove blacklist
anoadragon453 15bf108
Fix add_threepid template default values in emailconfig
anoadragon453 d20feec
Remove redundant logging
anoadragon453 0e5c7bf
Undo fix on password reset POST submit_token endpoint
anoadragon453 46da943
Update synapse/storage/registration.py
anoadragon453 3941439
Use an assert instead of if-statement with SynapseError
anoadragon453 0200e41
Remove trailing slashes from submit_token endpoint patterns
anoadragon453 c8dbf53
python3 super()
anoadragon453 d32724b
Remove self.hs set from AddThreepidSubmitTokenServlet
anoadragon453 0812664
Clarify changelog
anoadragon453 9309ca5
Merge branch 'anoa/account_3pid_homeserver_send_email' of github.com:…
anoadragon453 46e6d92
Sanity check ThreepidBehaviour.REMOTE on submit_token endpoint
anoadragon453 b37d71c
Re-blacklist tests
anoadragon453 16eb35d
Factor out removing id_server from msisdn
anoadragon453 16d7ec2
Remove POST /add_threepid/<medium>/submit_token
anoadragon453 ab1ae2f
Ensure REMOTE vs LOCAL ThreepidBehaviour is handled
anoadragon453 1be82f8
URL encode validation link parameters
anoadragon453 317332e
Move jinja failure template loading into servlet constructor
anoadragon453 59e0aad
Make add_threepid submit_token email-only
anoadragon453 882642e
Make get_threepid_validation_session require client_secret
anoadragon453 1464f14
Update changelog entry
anoadragon453 fb9c582
Set email
anoadragon453 f62ddf6
Make sure templates only get loaded when necessary
anoadragon453 0dcdfbb
Remove unnecessary vars and params
anoadragon453 d683ae5
Ensure link is not a tuple
anoadragon453 f62a27c
Pull if validation_session out of helper method
anoadragon453 ac92a58
this confused me for so long
anoadragon453 38a543c
Don't force https on account_threepid_delegates
anoadragon453 2f296c7
Merge branch 'develop' of github.com:matrix-org/synapse into anoa/acc…
anoadragon453 b12e51a
Ensure we catch HttpResponseException when calling to id servers
anoadragon453 1267abd
Unpack response from identity server to check for errors
anoadragon453 b3bf430
Remove prefix nonsense
anoadragon453 227ec33
Factor out password_reset trailing slash change
anoadragon453 4efc108
Address review comments
anoadragon453 7c351df
validation_session cannot be None
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
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Allow homeserver to handle or delegate email validation when adding an email to a user's account. |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -169,12 +169,22 @@ def read_config(self, config, **kwargs): | |
| self.email_registration_template_text = email_config.get( | ||
| "registration_template_text", "registration.txt" | ||
| ) | ||
| self.email_add_threepid_template_html = email_config.get( | ||
| "add_threepid_template_html", "add_threepid.html" | ||
| ) | ||
| self.email_add_threepid_template_text = email_config.get( | ||
| "add_threepid_template_text", "add_threepid.txt" | ||
| ) | ||
|
|
||
| self.email_password_reset_template_failure_html = email_config.get( | ||
| "password_reset_template_failure_html", "password_reset_failure.html" | ||
| ) | ||
| self.email_registration_template_failure_html = email_config.get( | ||
| "registration_template_failure_html", "registration_failure.html" | ||
| ) | ||
| self.email_add_threepid_template_failure_html = email_config.get( | ||
| "add_threepid_template_failure_html", "add_threepid_failure.html" | ||
| ) | ||
|
|
||
| # These templates do not support any placeholder variables, so we | ||
| # will read them from disk once during setup | ||
|
|
@@ -184,16 +194,24 @@ def read_config(self, config, **kwargs): | |
| email_registration_template_success_html = email_config.get( | ||
| "registration_template_success_html", "registration_success.html" | ||
| ) | ||
| email_add_threepid_template_success_html = email_config.get( | ||
| "add_threepid_template_success_html", "add_threepid_success.html" | ||
| ) | ||
|
|
||
| # Check templates exist | ||
| for f in [ | ||
| self.email_password_reset_template_html, | ||
| self.email_password_reset_template_text, | ||
| self.email_registration_template_html, | ||
| self.email_registration_template_text, | ||
| self.email_add_threepid_template_html, | ||
| self.email_add_threepid_template_text, | ||
| self.email_password_reset_template_failure_html, | ||
| self.email_registration_template_failure_html, | ||
|
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. This seemed to be missing :| |
||
| self.email_add_threepid_template_failure_html, | ||
| email_password_reset_template_success_html, | ||
| email_registration_template_success_html, | ||
| email_add_threepid_template_success_html, | ||
| ]: | ||
| p = os.path.join(self.email_template_dir, f) | ||
| if not os.path.isfile(p): | ||
|
|
@@ -212,6 +230,12 @@ def read_config(self, config, **kwargs): | |
| self.email_registration_template_success_html_content = self.read_file( | ||
| filepath, "email.registration_template_success_html" | ||
| ) | ||
| filepath = os.path.join( | ||
| self.email_template_dir, email_add_threepid_template_success_html | ||
| ) | ||
| self.email_add_threepid_template_success_html_content = self.read_file( | ||
| filepath, "email.add_threepid_template_success_html" | ||
| ) | ||
|
|
||
| if self.email_enable_notifs: | ||
| required = [ | ||
|
|
@@ -328,6 +352,12 @@ def generate_config_section(self, config_dir_path, server_name, **kwargs): | |
| # #registration_template_html: registration.html | ||
| # #registration_template_text: registration.txt | ||
| # | ||
| # # Templates for validation emails sent by the homeserver when adding an email to | ||
| # # your user account | ||
| # # | ||
| # #add_threepid_template_html: add_threepid.html | ||
| # #add_threepid_template_text: add_threepid.txt | ||
| # | ||
| # # Templates for password reset success and failure pages that a user | ||
| # # will see after attempting to reset their password | ||
| # # | ||
|
|
@@ -339,6 +369,12 @@ def generate_config_section(self, config_dir_path, server_name, **kwargs): | |
| # # | ||
| # #registration_template_success_html: registration_success.html | ||
| # #registration_template_failure_html: registration_failure.html | ||
| # | ||
| # # Templates for success and failure pages that a user will see after attempting | ||
| # # to add an email or phone to their account | ||
| # # | ||
| # #add_threepid_success_html: add_threepid_success.html | ||
| # #add_threepid_failure_html: add_threepid_failure.html | ||
| """ | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <html> | ||
| <body> | ||
| <p>A request to add an email address to your Matrix account has been received. If this was you, please click the link below to confirm adding this email:</p> | ||
|
|
||
| <a href="{{ link }}">{{ link }}</a> | ||
|
|
||
| <p>If this was not you, you can safely ignore this email. Thank you.</p> | ||
| </body> | ||
| </html> |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| A request to add an email address to your Matrix account has been received. If this was you, | ||
| please click the link below to confirm adding this email: | ||
|
|
||
| {{ link }} | ||
|
|
||
| If this was not you, you can safely ignore this email. Thank you. |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <html> | ||
| <head></head> | ||
| <body> | ||
| <p>The request failed for the following reason: {{ failure_reason }}.</p> | ||
|
|
||
| <p>No changes have been made to your account.</p> | ||
| </body> | ||
| </html> |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <html> | ||
| <head></head> | ||
| <body> | ||
| <p>Your email has now been validated, please return to your client. You may now close this window.</p> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.