style(user.service.ts): format code for clarity and consistency
All checks were successful
CI / Get Changed Files (pull_request) Successful in 7s
CI / prettier (pull_request) Successful in 26s
CI / Checkstyle Main (pull_request) Successful in 41s
CI / test-build (pull_request) Successful in 41s
CI / eslint (pull_request) Successful in 51s

This commit is contained in:
Jan K9f 2025-04-02 16:21:56 +02:00
parent e37dcecd3f
commit 47f4a4d558
Signed by: jank
GPG key ID: B9F475106B20F144

View file

@ -48,12 +48,12 @@ export class UserService {
// Authentik format might differ from Keycloak // Authentik format might differ from Keycloak
// Check different possible locations for the ID and username // Check different possible locations for the ID and username
const info = profile['info'] as Record<string, unknown> | undefined; const info = profile['info'] as Record<string, unknown> | undefined;
const id = info?.['sub'] as string || profile['sub'] as string; const id = (info?.['sub'] as string) || (profile['sub'] as string);
const username = const username =
info?.['preferred_username'] as string || (info?.['preferred_username'] as string) ||
profile['preferred_username'] as string || (profile['preferred_username'] as string) ||
profile['email'] as string || (profile['email'] as string) ||
profile['name'] as string; (profile['name'] as string);
if (!id || !username) { if (!id || !username) {
console.error('Could not extract user ID or username from profile', profile); console.error('Could not extract user ID or username from profile', profile);