Have OIDC first name fallback to name

If given/family names are unset, it seems reasonable to default to the
first name.
This commit is contained in:
TEC
2025-09-28 12:46:42 +08:00
parent f29b1b5784
commit bb886a5ff3

View File

@@ -229,6 +229,9 @@ def oidc_callback_route():
first_name = token_id_claims.get('given_name') or userinfo.get('given_name', '')
last_name = token_id_claims.get('family_name') or userinfo.get('family_name', '')
if not first_name and not last_name:
first_name = token_id_claims.get('name') or userinfo.get('name', '')
cur.execute('SELECT COUNT(*) FROM users')
user_count = cur.fetchone()[0]