mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 16:14:56 -04:00
Generate guest access token on 3pid invites
This means that following the same link across multiple sessions or devices can re-use the same guest account. Note that this is somewhat of an abuse vector; we can't throw up captchas on this flow, so this is a way of registering ephemeral accounts for spam, whose sign-up we don't rate limit.
This commit is contained in:
parent
869580206d
commit
33300673b7
4 changed files with 91 additions and 0 deletions
|
@ -349,3 +349,18 @@ class RegistrationHandler(BaseHandler):
|
|||
|
||||
def auth_handler(self):
|
||||
return self.hs.get_handlers().auth_handler
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def guest_access_token_for(self, medium, address, inviter_user_id):
|
||||
access_token = yield self.store.get_3pid_guest_access_token(medium, address)
|
||||
if access_token:
|
||||
defer.returnValue(access_token)
|
||||
|
||||
_, access_token = yield self.register(
|
||||
generate_token=True,
|
||||
make_guest=True
|
||||
)
|
||||
access_token = yield self.store.save_or_get_3pid_guest_access_token(
|
||||
medium, address, access_token, inviter_user_id
|
||||
)
|
||||
defer.returnValue(access_token)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue