ensure key pair generation
This commit is contained in:
parent
147e345976
commit
39bc7497f0
1 changed files with 2 additions and 0 deletions
|
@ -79,6 +79,7 @@ class Takahe:
|
||||||
user.email = handler
|
user.email = handler
|
||||||
user.save()
|
user.save()
|
||||||
domain = Domain.objects.get(domain=settings.SITE_INFO["site_domain"])
|
domain = Domain.objects.get(domain=settings.SITE_INFO["site_domain"])
|
||||||
|
# TODO add transaction protection here
|
||||||
identity = Identity.objects.filter(username=u.username, local=True).first()
|
identity = Identity.objects.filter(username=u.username, local=True).first()
|
||||||
if not identity:
|
if not identity:
|
||||||
logger.info(f"Creating takahe identity {u}@{domain}")
|
logger.info(f"Creating takahe identity {u}@{domain}")
|
||||||
|
@ -91,6 +92,7 @@ class Takahe:
|
||||||
local=True,
|
local=True,
|
||||||
discoverable=True,
|
discoverable=True,
|
||||||
)
|
)
|
||||||
|
if not identity.private_key and not identity.public_key:
|
||||||
identity.generate_keypair()
|
identity.generate_keypair()
|
||||||
identity.ensure_uris()
|
identity.ensure_uris()
|
||||||
if not user.identities.filter(pk=identity.pk).exists():
|
if not user.identities.filter(pk=identity.pk).exists():
|
||||||
|
|
Loading…
Add table
Reference in a new issue