Create ldap user only after successful login attempt.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -110,6 +110,12 @@ async fn ldap_login(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let user_id = services
|
||||||
|
.users
|
||||||
|
.auth_ldap(&user_dn, password)
|
||||||
|
.await
|
||||||
|
.map(|()| lowercased_user_id.to_owned())?;
|
||||||
|
|
||||||
// LDAP users are automatically created on first login attempt. This is a very
|
// LDAP users are automatically created on first login attempt. This is a very
|
||||||
// common feature that can be seen on many services using a LDAP provider for
|
// common feature that can be seen on many services using a LDAP provider for
|
||||||
// their users (synapse, Nextcloud, Jellyfin, ...).
|
// their users (synapse, Nextcloud, Jellyfin, ...).
|
||||||
@@ -124,12 +130,7 @@ async fn ldap_login(
|
|||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("{user_dn:?} {password:?}");
|
Ok(user_id)
|
||||||
services
|
|
||||||
.users
|
|
||||||
.auth_ldap(&user_dn, password)
|
|
||||||
.await
|
|
||||||
.map(|()| lowercased_user_id.to_owned())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # `POST /_matrix/client/v3/login`
|
/// # `POST /_matrix/client/v3/login`
|
||||||
|
|||||||
Reference in New Issue
Block a user