fix(auth): oidc service updates

This commit is contained in:
null 2026-06-07 18:05:09 -05:00
parent 9354af8cb8
commit 12bcd1d8f3
1 changed files with 3 additions and 2 deletions

View File

@ -707,11 +707,12 @@ async function findOrProvisionUser(claims, config) {
throw Object.assign(new Error('This account is inactive.'), { status: 403 });
}
// Refresh login timestamp and display name from provider claims
// Refresh login timestamp; only seed display_name from provider on first login
// (display_name IS NULL). Once the user has set one manually, preserve it.
db.prepare(`
UPDATE users
SET last_login_at = datetime('now'),
display_name = COALESCE(?, display_name),
display_name = CASE WHEN display_name IS NULL THEN ? ELSE display_name END,
updated_at = datetime('now')
WHERE id = ?
`).run(claims.name || null, user.id);