mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-10 00:23:03 +02:00
chore: remove unused LDAP mail attribute
This commit is contained in:
parent
c7adbae03f
commit
fb7e739b72
3 changed files with 20 additions and 32 deletions
|
@ -156,9 +156,9 @@ pub(super) async fn ldap_login(
|
|||
pub(crate) async fn handle_login(
|
||||
services: &Services,
|
||||
body: &Ruma<login::v3::Request>,
|
||||
identifier: &Option<uiaa::UserIdentifier>,
|
||||
identifier: Option<&uiaa::UserIdentifier>,
|
||||
password: &str,
|
||||
user: &Option<String>,
|
||||
user: Option<&String>,
|
||||
) -> Result<OwnedUserId> {
|
||||
debug!("Got password login type");
|
||||
let user_id =
|
||||
|
@ -185,7 +185,7 @@ pub(crate) async fn handle_login(
|
|||
}
|
||||
|
||||
if cfg!(feature = "ldap") && services.config.ldap.enable {
|
||||
ldap_login(services, &user_id, &lowercased_user_id, password).await
|
||||
Box::pin(ldap_login(services, &user_id, &lowercased_user_id, password)).await
|
||||
} else {
|
||||
password_login(services, &user_id, &lowercased_user_id, password).await
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ pub(crate) async fn login_route(
|
|||
password,
|
||||
user,
|
||||
..
|
||||
}) => handle_login(&services, &body, identifier, password, user).await?,
|
||||
}) => handle_login(&services, &body, identifier.as_ref(), password, user.as_ref()).await?,
|
||||
| login::v3::LoginInfo::Token(login::v3::Token { token }) => {
|
||||
debug!("Got token login type");
|
||||
if !services.server.config.login_via_existing_session {
|
||||
|
|
|
@ -2063,7 +2063,7 @@ pub struct LdapConfig {
|
|||
/// Root of the searches.
|
||||
///
|
||||
/// example: "ou=users,dc=example,dc=org"
|
||||
#[serde(default)]
|
||||
#[serde(default = "empty_string_fn")]
|
||||
pub base_dn: String,
|
||||
|
||||
/// Bind DN if anonymous search is not enabled.
|
||||
|
@ -2076,7 +2076,7 @@ pub struct LdapConfig {
|
|||
///
|
||||
/// example: "cn=ldap-reader,dc=example,dc=org" or
|
||||
/// "cn={username},ou=users,dc=example,dc=org"
|
||||
#[serde(default)]
|
||||
#[serde(default = "some_empty_string_fn")]
|
||||
pub bind_dn: Option<String>,
|
||||
|
||||
/// Path to a file on the system that contains the password for the
|
||||
|
@ -2105,15 +2105,7 @@ pub struct LdapConfig {
|
|||
#[serde(default = "default_ldap_uid_attribute")]
|
||||
pub uid_attribute: String,
|
||||
|
||||
/// Attribute containing the mail of the user.
|
||||
///
|
||||
/// example: "mail"
|
||||
///
|
||||
/// default: "mail"
|
||||
#[serde(default = "default_ldap_mail_attribute")]
|
||||
pub mail_attribute: String,
|
||||
|
||||
/// Attribute containing the distinguished name of the user.
|
||||
/// Attribute containing the display name of the user.
|
||||
///
|
||||
/// example: "givenName" or "sn"
|
||||
///
|
||||
|
@ -2126,10 +2118,10 @@ pub struct LdapConfig {
|
|||
/// Defaults to `base_dn` if empty.
|
||||
///
|
||||
/// example: "ou=admins,dc=example,dc=org"
|
||||
#[serde(default)]
|
||||
#[serde(default = "empty_string_fn")]
|
||||
pub admin_base_dn: String,
|
||||
|
||||
/// The LDAP search filter to find administrative users for conduwuit.
|
||||
/// The LDAP search filter to find administrative users for continuwuity.
|
||||
///
|
||||
/// If left blank, administrative state must be configured manually for each
|
||||
/// user.
|
||||
|
@ -2138,7 +2130,7 @@ pub struct LdapConfig {
|
|||
/// entered username for more complex filters.
|
||||
///
|
||||
/// example: "(objectClass=conduwuitAdmin)" or "(uid={username})"
|
||||
#[serde(default)]
|
||||
#[serde(default = "empty_string_fn")]
|
||||
pub admin_filter: String,
|
||||
}
|
||||
|
||||
|
@ -2240,6 +2232,10 @@ impl Config {
|
|||
|
||||
fn true_fn() -> bool { true }
|
||||
|
||||
fn empty_string_fn() -> String { String::new() }
|
||||
|
||||
fn some_empty_string_fn() -> Option<String> { Some(String::new()) }
|
||||
|
||||
fn default_address() -> ListeningAddr {
|
||||
ListeningAddr {
|
||||
addrs: Right(vec![Ipv4Addr::LOCALHOST.into(), Ipv6Addr::LOCALHOST.into()]),
|
||||
|
@ -2536,6 +2532,4 @@ fn default_ldap_search_filter() -> String { "(objectClass=*)".to_owned() }
|
|||
|
||||
fn default_ldap_uid_attribute() -> String { String::from("uid") }
|
||||
|
||||
fn default_ldap_mail_attribute() -> String { String::from("mail") }
|
||||
|
||||
fn default_ldap_name_attribute() -> String { String::from("givenName") }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue