Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow password providers to bind emails #4947

Merged
merged 4 commits into from Mar 28, 2019

Conversation

Projects
None yet
2 participants
@anoadragon453
Copy link
Member

commented Mar 26, 2019

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

anoadragon453 added some commits Mar 26, 2019

@anoadragon453 anoadragon453 requested a review from matrix-org/synapse-core Mar 26, 2019

@codecov

This comment has been minimized.

Copy link

commented Mar 26, 2019

Codecov Report

Merging #4947 into develop will decrease coverage by <.01%.
The diff coverage is 40%.

@@             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
threepid_dict = {
"medium": "email",
"address": email,
"validated_at": self.hs.get_clock().time_msec(),

This comment has been minimized.

Copy link
@richvdh

richvdh Mar 27, 2019

Member

you are ignoring the validated_at param

}

# Bind email to new account
yield self._register_email_threepid(

This comment has been minimized.

Copy link
@richvdh

richvdh Mar 27, 2019

Member

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(...)

This comment has been minimized.

Copy link
@anoadragon453

anoadragon453 Mar 27, 2019

Author Member

Good to know, thanks!

@@ -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):

This comment has been minimized.

Copy link
@richvdh

richvdh Mar 27, 2019

Member

unless you have a reason for factoring this out, i feel like it may as well be inlined.

anoadragon453 added some commits Mar 27, 2019

Addressed changes

@anoadragon453 anoadragon453 requested review from richvdh and matrix-org/synapse-core Mar 27, 2019

@richvdh
Copy link
Member

left a comment

lgtm

@anoadragon453 anoadragon453 merged commit 7a91b9d into develop Mar 28, 2019

24 checks passed

buildkite/synapse Build #646 passed (13 minutes, 9 seconds)
Details
buildkite/synapse/check-sample-config Passed (1 minute, 5 seconds)
Details
buildkite/synapse/isort Passed (14 seconds)
Details
buildkite/synapse/newspaper-newsfile Passed (12 seconds)
Details
buildkite/synapse/packaging Passed (29 seconds)
Details
buildkite/synapse/pep-8 Passed (48 seconds)
Details
buildkite/synapse/pipeline Passed (2 seconds)
Details
buildkite/synapse/python-2-dot-7-slash-postgres-9-dot-4 Passed (11 minutes, 1 second)
Details
buildkite/synapse/python-2-dot-7-slash-postgres-9-dot-5 Passed (11 minutes, 24 seconds)
Details
buildkite/synapse/python-2-dot-7-slash-sqlite Passed (6 minutes, 24 seconds)
Details
buildkite/synapse/python-2-dot-7-slash-sqlite-slash-old-deps Passed (8 minutes, 5 seconds)
Details
buildkite/synapse/python-3-dot-5-slash-postgres-9-dot-4 Passed (12 minutes, 5 seconds)
Details
buildkite/synapse/python-3-dot-5-slash-postgres-9-dot-5 Passed (11 minutes, 56 seconds)
Details
buildkite/synapse/python-3-dot-5-slash-sqlite Passed (6 minutes, 53 seconds)
Details
buildkite/synapse/python-3-dot-6-slash-sqlite Passed (6 minutes, 43 seconds)
Details
buildkite/synapse/python-3-dot-7-slash-postgres-11 Passed (11 minutes, 55 seconds)
Details
buildkite/synapse/python-3-dot-7-slash-postgres-9-dot-5 Passed (12 minutes, 8 seconds)
Details
buildkite/synapse/python-3-dot-7-slash-sqlite Passed (6 minutes, 56 seconds)
Details
ci/circleci: sytestpy2merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy2postgresmerged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3postgresmerged Your tests passed on CircleCI!
Details
codecov/patch 40% of diff hit (target 0%)
Details
codecov/project 60.43% (target 0%)
Details

@anoadragon453 anoadragon453 deleted the anoa/3pid_email_binding branch Mar 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.