From 10b9f859a98582ca98fde4b29daae40a6908d6ad Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Wed, 26 Jun 2024 21:25:40 +0800 Subject: [PATCH] only create keys if they don't have any #225 --- app/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/utils.py b/app/utils.py index 6d969e32..7fd158da 100644 --- a/app/utils.py +++ b/app/utils.py @@ -776,9 +776,10 @@ def finalize_user_setup(user): from app.activitypub.signature import RsaKeys user.verified = True user.last_seen = utcnow() - private_key, public_key = RsaKeys.generate_keypair() - user.private_key = private_key - user.public_key = public_key + if user.private_key is None and user.public_key is None: + private_key, public_key = RsaKeys.generate_keypair() + user.private_key = private_key + user.public_key = public_key user.ap_profile_id = f"https://{current_app.config['SERVER_NAME']}/u/{user.user_name}".lower() user.ap_public_url = f"https://{current_app.config['SERVER_NAME']}/u/{user.user_name}" user.ap_inbox_url = f"https://{current_app.config['SERVER_NAME']}/u/{user.user_name.lower()}/inbox"