From 39bc7497f05d6e149a54dda5d87d099cf0cd460f Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 16 Jul 2024 15:09:20 -0400 Subject: [PATCH] ensure key pair generation --- takahe/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/takahe/utils.py b/takahe/utils.py index a6dce7c7..5bbc5569 100644 --- a/takahe/utils.py +++ b/takahe/utils.py @@ -79,6 +79,7 @@ class Takahe: user.email = handler user.save() 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() if not identity: logger.info(f"Creating takahe identity {u}@{domain}") @@ -91,6 +92,7 @@ class Takahe: local=True, discoverable=True, ) + if not identity.private_key and not identity.public_key: identity.generate_keypair() identity.ensure_uris() if not user.identities.filter(pk=identity.pk).exists():