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:
@@ -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 =
|
||||
|
||||
@@ -19,6 +19,8 @@ import { Profile } from 'passport';
|
||||
/** @public */
|
||||
export type PassportProfile = Profile & {
|
||||
avatarUrl?: string;
|
||||
email?: string;
|
||||
photo?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
|
||||
Reference in New Issue
Block a user