Loomio username fix: allow hyphens in uids (was falling through to email local-part for inference-admin/bot)
This commit is contained in:
1 parent
ef253d01a0
commit
cddd9b6e3c
1 file changed
+3
-2
+3
-2
@@ -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"]:
|
||||
|
||||
Reference in new issue
Block a user