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
Package registry
Container Registry
Model registry
Operate
Terraform modules
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
Timo Ley
synapse
Commits
77dc7093
Commit
77dc7093
authored
5 years ago
by
Neil Johnson
Committed by
Richard van der Hoff
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Threepid validity checks on msisdns should not be dependent on 'threepid_behaviour_email'. (#6104)
Fixes #6103
parent
990928ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/6104.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/6104.bugfix
synapse/handlers/ui_auth/checkers.py
+34
-29
34 additions, 29 deletions
synapse/handlers/ui_auth/checkers.py
with
35 additions
and
29 deletions
changelog.d/6104.bugfix
0 → 100644
+
1
−
0
View file @
77dc7093
Threepid validity checks on msisdns should not be dependent on 'threepid_behaviour_email'.
This diff is collapsed.
Click to expand it.
synapse/handlers/ui_auth/checkers.py
+
34
−
29
View file @
77dc7093
...
...
@@ -148,42 +148,47 @@ class _BaseThreepidAuthChecker:
identity_handler
=
self
.
hs
.
get_handlers
().
identity_handler
logger
.
info
(
"
Getting validated threepid. threepidcreds: %r
"
,
(
threepid_creds
,))
if
self
.
hs
.
config
.
threepid_behaviour_email
==
ThreepidBehaviour
.
REMOTE
:
if
medium
==
"
email
"
:
# msisdns are currently always ThreepidBehaviour.REMOTE
if
medium
==
"
msisdn
"
:
if
not
self
.
hs
.
config
.
account_threepid_delegate_msisdn
:
raise
SynapseError
(
400
,
"
Phone number verification is not enabled on this homeserver
"
)
threepid
=
yield
identity_handler
.
threepid_from_creds
(
self
.
hs
.
config
.
account_threepid_delegate_msisdn
,
threepid_creds
)
elif
medium
==
"
email
"
:
if
self
.
hs
.
config
.
threepid_behaviour_email
==
ThreepidBehaviour
.
REMOTE
:
assert
self
.
hs
.
config
.
account_threepid_delegate_email
threepid
=
yield
identity_handler
.
threepid_from_creds
(
self
.
hs
.
config
.
account_threepid_delegate_email
,
threepid_creds
)
elif
medium
==
"
msisdn
"
:
threepid
=
yield
identity_handler
.
threepid_from_creds
(
self
.
hs
.
config
.
account_threepid_delegate_msisdn
,
threepid_creds
elif
self
.
hs
.
config
.
threepid_behaviour_email
==
ThreepidBehaviour
.
LOCAL
:
threepid
=
None
row
=
yield
self
.
store
.
get_threepid_validation_session
(
medium
,
threepid_creds
[
"
client_secret
"
],
sid
=
threepid_creds
[
"
sid
"
],
validated
=
True
,
)
else
:
raise
SynapseError
(
400
,
"
Unrecognized threepid medium: %s
"
%
(
medium
,))
elif
self
.
hs
.
config
.
threepid_behaviour_email
==
ThreepidBehaviour
.
LOCAL
:
row
=
yield
self
.
store
.
get_threepid_validation_session
(
medium
,
threepid_creds
[
"
client_secret
"
],
sid
=
threepid_creds
[
"
sid
"
],
validated
=
True
,
)
threepid
=
(
{
"
medium
"
:
row
[
"
medium
"
],
"
address
"
:
row
[
"
address
"
],
"
validated_at
"
:
row
[
"
validated_at
"
],
}
if
row
else
None
)
if
row
:
threepid
=
{
"
medium
"
:
row
[
"
medium
"
],
"
address
"
:
row
[
"
address
"
],
"
validated_at
"
:
row
[
"
validated_at
"
],
}
if
row
:
# Valid threepid returned, delete from the db
yield
self
.
store
.
delete_threepid_session
(
threepid_creds
[
"
sid
"
])
# Valid threepid returned, delete from the db
yield
self
.
store
.
delete_threepid_session
(
threepid_creds
[
"
sid
"
])
else
:
raise
SynapseError
(
400
,
"
Email address verification is not enabled on this homeserver
"
)
else
:
raise
SynapseError
(
400
,
"
Password resets are not enabled on this homeserver
"
)
# this can't happen!
raise
AssertionError
(
"
Unrecognized threepid medium: %s
"
%
(
medium
,))
if
not
threepid
:
raise
LoginError
(
401
,
""
,
errcode
=
Codes
.
UNAUTHORIZED
)
...
...
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