fix(auth): oidc service updates
This commit is contained in:
parent
9354af8cb8
commit
12bcd1d8f3
|
|
@ -707,11 +707,12 @@ async function findOrProvisionUser(claims, config) {
|
||||||
throw Object.assign(new Error('This account is inactive.'), { status: 403 });
|
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(`
|
db.prepare(`
|
||||||
UPDATE users
|
UPDATE users
|
||||||
SET last_login_at = datetime('now'),
|
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')
|
updated_at = datetime('now')
|
||||||
WHERE id = ?
|
WHERE id = ?
|
||||||
`).run(claims.name || null, user.id);
|
`).run(claims.name || null, user.id);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue