aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/api/users.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/api/users.py')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/api/users.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/api/users.py b/packages/meshbay-hub/src/meshbay_hub/api/users.py
index b7b402f..0bfbcac 100644
--- a/packages/meshbay-hub/src/meshbay_hub/api/users.py
+++ b/packages/meshbay-hub/src/meshbay_hub/api/users.py
@@ -7,7 +7,7 @@ from datetime import datetime, timezone, timedelta
from fastapi import APIRouter, Depends, HTTPException, Request, status
from pydantic import BaseModel, field_validator
-from sqlalchemy import delete, select
+from sqlalchemy import delete, select, update
from sqlalchemy.ext.asyncio import AsyncSession
from meshbay_hub.auth import (
@@ -365,6 +365,11 @@ async def erase_account(db: AsyncSession, user: User) -> dict:
await db.execute(delete(Node).where(Node.user_id == user.id))
username = user.username
+ # Before the name is released: the connection log is kept for its legal
+ # retention period and has to stay readable, which means saying who this was
+ # and not "deleted-3f9a1c". Nothing else keeps it.
+ await db.execute(
+ update(IPLog).where(IPLog.user_id == user.id).values(username=username))
user.username = f"deleted-{user.id[:8]}"
user.email = ""
user.pw_hash = b""