mirror of
https://github.com/wekan/wekan.git
synced 2026-11-07 02:52:33 -05:00
Route existing and first-time LDAP username credentials through Meteor server login handlers instead of requiring a local bcrypt password. Preserve uniform failures, throttling, two-factor checks, REST token creation, and local-password behavior. Thanks to mariogalan, ViViDboarder, mgiacomoli, HaKePlan and xet7 ! Fixes #3707,
17 lines
413 B
JavaScript
17 lines
413 B
JavaScript
function useLdapForRestLogin({ user, ldapEnabled, usernameProvided }) {
|
|
if (!ldapEnabled || !usernameProvided) return false;
|
|
if (!user) return true;
|
|
return user.authenticationMethod === 'ldap';
|
|
}
|
|
|
|
function ldapRestLoginRequest(username, password) {
|
|
return {
|
|
ldap: true,
|
|
username,
|
|
ldapPass: password,
|
|
ldapOptions: {},
|
|
};
|
|
}
|
|
|
|
module.exports = { useLdapForRestLogin, ldapRestLoginRequest };
|