Skip to content

Commit 6e62f30

Browse files
committed
LDAP local placeholder should return username when its not an email address (closes #1784)
1 parent 4c954c9 commit 6e62f30

File tree

1 file changed

+6
-3
lines changed
  • crates/directory/src/backend/ldap

1 file changed

+6
-3
lines changed

crates/directory/src/backend/ldap/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ impl LdapFilter {
5858
LdapFilterItem::Static(s) => result.push_str(s),
5959
LdapFilterItem::Full => result.push_str(ldap_escape(value).as_ref()),
6060
LdapFilterItem::LocalPart => {
61-
if let Some((value, _)) = value.rsplit_once('@') {
62-
result.push_str(value);
63-
}
61+
result.push_str(
62+
value
63+
.rsplit_once('@')
64+
.map(|(local, _)| local)
65+
.unwrap_or(value),
66+
);
6467
}
6568
LdapFilterItem::DomainPart => {
6669
if let Some((_, domain)) = value.rsplit_once('@') {

0 commit comments

Comments
 (0)