-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Allow password providers to bind emails #4947
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4947 +/- ##
===========================================
- Coverage 60.43% 60.43% -0.01%
===========================================
Files 328 328
Lines 34093 34097 +4
Branches 5627 5628 +1
===========================================
+ Hits 20605 20606 +1
- Misses 12017 12019 +2
- Partials 1471 1472 +1 |
synapse/handlers/register.py
Outdated
threepid_dict = { | ||
"medium": "email", | ||
"address": email, | ||
"validated_at": self.hs.get_clock().time_msec(), |
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.
you are ignoring the validated_at
param
synapse/handlers/register.py
Outdated
} | ||
|
||
# Bind email to new account | ||
yield self._register_email_threepid( |
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.
for the record: where you have a function which just does some synchronous things and ends up calling an asynchronous function, you can skip @inlineCallbacks
and just return the deferred from the other function:
def bind_email_to_account():
do_synchronous_stuff()
return self._register_email_threepid(...)
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.
Good to know, thanks!
synapse/handlers/register.py
Outdated
@@ -406,6 +412,32 @@ def register_email(self, threepidCreds): | |||
403, "Third party identifier is not allowed" | |||
) | |||
|
|||
@defer.inlineCallbacks | |||
def bind_email_to_account(self, user_id, email, validated_at=None): |
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.
unless you have a reason for factoring this out, i feel like it may as well be inlined.
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.
lgtm
This PR allows password provider modules to bind email addresses when a user is registering and is motivated by matrix-org/matrix-synapse-ldap3#58