Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check user email or unique name in AD #266

Merged
merged 1 commit into from
Jun 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions backend/src/modules/azure/services/auth.azure.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ export default class AuthAzureServiceImpl implements AuthAzureService {
const lastName =
family_name ?? splitedName[splitedName.length - 1] ?? 'last';

const userExists = await this.checkUserExistsInActiveDirectory(email);
const emailOrUniqueName = email ?? unique_name;

const userExists = await this.checkUserExistsInActiveDirectory(
emailOrUniqueName,
);
if (!userExists) return null;

const emailOrUniqueName = email ?? unique_name;
const user = await this.getUserService.getByEmail(emailOrUniqueName);
if (user) return signIn(user, this.getTokenService, 'azure');

Expand Down