fix(core): Fix issue that prevents owner logging in when using ldap (#7408)

This PR prioritises the internal email account over LDAP for the Owner.

---------

Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
Jon
2023-11-02 03:02:49 +00:00
committed by GitHub
parent 437c95e84e
commit 479f90231d
4 changed files with 45 additions and 6 deletions

View File

@@ -66,7 +66,13 @@ export class AuthController {
throw new AuthError('SSO is enabled, please log in with SSO');
}
} else if (isLdapCurrentAuthenticationMethod()) {
user = await handleLdapLogin(email, password);
const preliminaryUser = await handleEmailLogin(email, password);
if (preliminaryUser?.globalRole?.name === 'owner') {
user = preliminaryUser;
usedAuthenticationMethod = 'email';
} else {
user = await handleLdapLogin(email, password);
}
} else {
user = await handleEmailLogin(email, password);
}