Simplify the bug fix, by implementing logic in the PassportHelper

Signed-off-by: Olivier Liechti <olivier.liechti@wasabi-tech.com>
This commit is contained in:
Olivier Liechti
2024-07-09 16:29:50 +02:00
parent efda5a301d
commit 55c1a729ac
6 changed files with 22 additions and 34 deletions
@@ -42,12 +42,19 @@ export class PassportHelpers {
email = firstEmail.value;
}
// This is the case for Atlassian
if (profile.email) {
email = profile.email;
}
let picture: string | undefined = undefined;
if (profile.avatarUrl) {
picture = profile.avatarUrl;
} else if (profile.photos && profile.photos.length > 0) {
const [firstPhoto] = profile.photos;
picture = firstPhoto.value;
} else if (profile.photo) {
picture = profile.photo; // This is the case for Atlassian
}
let displayName: string | undefined =
+2
View File
@@ -19,6 +19,8 @@ import { Profile } from 'passport';
/** @public */
export type PassportProfile = Profile & {
avatarUrl?: string;
email?: string;
photo?: string;
};
/** @public */