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
6b1e9b8d
Commit
6b1e9b8d
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Plain Diff
Merge pull request #645 from matrix-org/erikj/3pid_guest_config
Add config to create guest account on 3pid invite
parents
a547e2df
590fbbef
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
synapse/config/registration.py
+4
-0
4 additions, 0 deletions
synapse/config/registration.py
synapse/handlers/room.py
+32
-25
32 additions, 25 deletions
synapse/handlers/room.py
with
36 additions
and
25 deletions
synapse/config/registration.py
+
4
−
0
View file @
6b1e9b8d
...
...
@@ -37,6 +37,10 @@ class RegistrationConfig(Config):
self
.
trusted_third_party_id_servers
=
config
[
"
trusted_third_party_id_servers
"
]
self
.
allow_guest_access
=
config
.
get
(
"
allow_guest_access
"
,
False
)
self
.
invite_3pid_guest
=
(
self
.
allow_guest_access
and
config
.
get
(
"
invite_3pid_guest
"
,
False
)
)
def
default_config
(
self
,
**
kwargs
):
registration_shared_secret
=
random_string_with_symbols
(
50
)
...
...
This diff is collapsed.
Click to expand it.
synapse/handlers/room.py
+
32
−
25
View file @
6b1e9b8d
...
...
@@ -877,36 +877,43 @@ class RoomMemberHandler(BaseHandler):
user.
"""
registration_handler
=
self
.
hs
.
get_handlers
().
registration_handler
guest_access_token
=
yield
registration_handler
.
guest_access_token_for
(
medium
=
medium
,
address
=
address
,
inviter_user_id
=
inviter_user_id
,
)
guest_user_info
=
yield
self
.
hs
.
get_auth
().
get_user_by_access_token
(
guest_access_token
)
is_url
=
"
%s%s/_matrix/identity/api/v1/store-invite
"
%
(
id_server_scheme
,
id_server
,
)
invite_config
=
{
"
medium
"
:
medium
,
"
address
"
:
address
,
"
room_id
"
:
room_id
,
"
room_alias
"
:
room_alias
,
"
room_avatar_url
"
:
room_avatar_url
,
"
room_join_rules
"
:
room_join_rules
,
"
room_name
"
:
room_name
,
"
sender
"
:
inviter_user_id
,
"
sender_display_name
"
:
inviter_display_name
,
"
sender_avatar_url
"
:
inviter_avatar_url
,
}
if
self
.
hs
.
config
.
invite_3pid_guest
:
registration_handler
=
self
.
hs
.
get_handlers
().
registration_handler
guest_access_token
=
yield
registration_handler
.
guest_access_token_for
(
medium
=
medium
,
address
=
address
,
inviter_user_id
=
inviter_user_id
,
)
guest_user_info
=
yield
self
.
hs
.
get_auth
().
get_user_by_access_token
(
guest_access_token
)
invite_config
.
update
({
"
guest_access_token
"
:
guest_access_token
,
"
guest_user_id
"
:
guest_user_info
[
"
user
"
].
to_string
(),
})
data
=
yield
self
.
hs
.
get_simple_http_client
().
post_urlencoded_get_json
(
is_url
,
{
"
medium
"
:
medium
,
"
address
"
:
address
,
"
room_id
"
:
room_id
,
"
room_alias
"
:
room_alias
,
"
room_avatar_url
"
:
room_avatar_url
,
"
room_join_rules
"
:
room_join_rules
,
"
room_name
"
:
room_name
,
"
sender
"
:
inviter_user_id
,
"
sender_display_name
"
:
inviter_display_name
,
"
sender_avatar_url
"
:
inviter_avatar_url
,
"
guest_user_id
"
:
guest_user_info
[
"
user
"
].
to_string
(),
"
guest_access_token
"
:
guest_access_token
,
}
invite_config
)
# TODO: Check for success
token
=
data
[
"
token
"
]
...
...
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