8000 Convert email address obtained from LDAP to lowercase before comparin… by njpaul · Pull Request #82 · wekan/ldap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Dec 22, 2024. It is now read-only.

Convert email address obtained from LDAP to lowercase before comparin… #82

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion server/loginHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Accounts.registerLoginHandler('ldap', function(loginRequest) {

if (!user && email && LDAP.settings_get('LDAP_EMAIL_MATCH_ENABLE') === true) {

log_info('No user exists with username', username, '- attempting to find by e-mail address instead');
log_info(`No user exists with username ${username} - attempting to find by e-mail address instead`);

if(LDAP.settings_get('LDAP_EMAIL_MATCH_VERIFIED') === true) {
userQuery = {
Expand Down
7 changes: 5 additions & 2 deletions server/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ export function getLdapUsername(ldapUser) {
export function getLdapEmail(ldapUser) {
const emailField = LDAP.settings_get('LDAP_EMAIL_FIELD');

let email;
if (emailField.indexOf('#{') > -1) {
return emailField.replace(/#{(.+?)}/g, function(match, field) {
email = emailField.replace(/#{(.+?)}/g, function (match, field) {
return ldapUser.getLDAPValue(field);
});
} else {
email = ldapUser.getLDAPValue(emailField);
}

return ldapUser.getLDAPValue(emailField);
return email.toLowerCase();
}

export function getLdapFullname(ldapUser) {
Expand Down
0