actor: check if the inbound message is an auth message or not

This commit is contained in:
William Pitcock 2018-08-17 17:36:05 -05:00
parent 9c92a6bc0e
commit 0742ff20b0
2 changed files with 7 additions and 1 deletions

View file

@ -90,7 +90,11 @@ from .authreqs import check_reqs
async def handle_create(actor, data, request): async def handle_create(actor, data, request):
content = strip_html(data['object']['content']).split() content = strip_html(data['object']['content']).split()
check_reqs(content, actor)
# check if the message is an authorization token for linking identities together
# if it is, then it's not a message we want to relay to IRC.
if check_reqs(content, actor):
return
async def handle_follow(actor, data, request): async def handle_follow(actor, data, request):

View file

@ -33,6 +33,8 @@ def check_reqs(chunks, actor):
DATABASE["auths"][req.irc_account] = req.actor DATABASE["auths"][req.irc_account] = req.actor
return True in results
def new_auth_req(irc_nickname, irc_account): def new_auth_req(irc_nickname, irc_account):
authid = str(uuid.uuid4()) authid = str(uuid.uuid4())