Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
600ec047
Commit
600ec047
authored
6 years ago
by
Brendan Abolivier
Browse files
Options
Downloads
Patches
Plain Diff
Make sure we're not registering the same 3pid twice
parent
35442efb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/5071.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/5071.bugfix
synapse/rest/client/v2_alpha/register.py
+18
-0
18 additions, 0 deletions
synapse/rest/client/v2_alpha/register.py
with
19 additions
and
0 deletions
changelog.d/5071.bugfix
0 → 100644
+
1
−
0
View file @
600ec047
Make sure we're not registering the same 3pid twice on registration.
This diff is collapsed.
Click to expand it.
synapse/rest/client/v2_alpha/register.py
+
18
−
0
View file @
600ec047
...
@@ -391,6 +391,13 @@ class RegisterRestServlet(RestServlet):
...
@@ -391,6 +391,13 @@ class RegisterRestServlet(RestServlet):
# the user-facing checks will probably already have happened in
# the user-facing checks will probably already have happened in
# /register/email/requestToken when we requested a 3pid, but that's not
# /register/email/requestToken when we requested a 3pid, but that's not
# guaranteed.
# guaranteed.
#
# Also check that we're not trying to register a 3pid that's already
# been registered.
#
# This has probably happened in /register/email/requestToken as well,
# but if a user hits this endpoint twice then clicks on each link from
# the two activation emails, they would register the same 3pid twice.
if
auth_result
:
if
auth_result
:
for
login_type
in
[
LoginType
.
EMAIL_IDENTITY
,
LoginType
.
MSISDN
]:
for
login_type
in
[
LoginType
.
EMAIL_IDENTITY
,
LoginType
.
MSISDN
]:
...
@@ -406,6 +413,17 @@ class RegisterRestServlet(RestServlet):
...
@@ -406,6 +413,17 @@ class RegisterRestServlet(RestServlet):
Codes
.
THREEPID_DENIED
,
Codes
.
THREEPID_DENIED
,
)
)
existingUid
=
yield
self
.
store
.
get_user_id_by_threepid
(
medium
,
address
,
)
if
existingUid
is
not
None
:
raise
SynapseError
(
400
,
"
%s is already in use
"
%
medium
,
Codes
.
THREEPID_IN_USE
,
)
if
registered_user_id
is
not
None
:
if
registered_user_id
is
not
None
:
logger
.
info
(
logger
.
info
(
"
Already registered user ID %r for this session
"
,
"
Already registered user ID %r for this session
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment