Fixes following external fedireads user

Fixes #42
This commit is contained in:
Mouse Reeve
2020-02-19 11:33:00 -08:00
parent bf58e29a54
commit f7867da7a0
7 changed files with 29 additions and 30 deletions

View File

@ -29,23 +29,21 @@ def get_or_create_remote_user(actor):
shared_inbox = data.get('endpoints').get('sharedInbox') if \
data.get('endpoints') else None
try:
user = models.User.objects.create_user(
username,
'', '', # email and passwords are left blank
actor=actor,
name=data.get('name'),
summary=data.get('summary'),
inbox=data['inbox'], #fail if there's no inbox
outbox=data['outbox'], # fail if there's no outbox
shared_inbox=shared_inbox,
# TODO: I'm never actually using this for remote users
public_key=data.get('publicKey').get('publicKeyPem'),
local=False,
fedireads_user=False,
)
except KeyError:
return False
# throws a key error if it can't find any of these fields
user = models.User.objects.create_user(
username,
'', '', # email and passwords are left blank
actor=actor,
name=data.get('name'),
summary=data.get('summary'),
inbox=data['inbox'], #fail if there's no inbox
outbox=data['outbox'], # fail if there's no outbox
shared_inbox=shared_inbox,
# TODO: I'm never actually using this for remote users
public_key=data.get('publicKey').get('publicKeyPem'),
local=False,
fedireads_user=data.get('fedireadsUser', False),
)
return user