diff --git a/app/main.py b/app/main.py index 05e686e..ee9122f 100644 --- a/app/main.py +++ b/app/main.py @@ -797,10 +797,11 @@ async def loomio_fix_usernames(client: httpx.AsyncClient) -> dict: for ident in u.get("identities") or []: if ident.get("identity_type") == "oauth" and ident.get("uid"): uid = ident["uid"].lower() - # Loomio usernames: lowercase letters, numbers, underscores only. - if uid.replace("_", "").isalnum() and len(uid) >= 2: + # Loomio usernames allow lowercase letters, numbers, underscores and hyphens. + if uid.replace("_", "").replace("-", "").isalnum() and len(uid) >= 2: target = uid break + # uid unusable (dots etc) — use email local-part instead target = (u.get("email") or "").split("@")[0].lower() or None break if not target and u.get("email") and "@" in u["email"]: