feat: Allow admins to disable the login capability of an account
# Conflicts: # src/admin/user/commands.rs
This commit is contained in:
parent
3483059e1c
commit
1c816850ed
5 changed files with 103 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ use axum_client_ip::InsecureClientIp;
|
|||
use conduwuit::{
|
||||
Err, Error, Result, debug, err, info,
|
||||
utils::{self, ReadyExt, hash},
|
||||
warn,
|
||||
};
|
||||
use conduwuit_core::{debug_error, debug_warn};
|
||||
use conduwuit_service::{Services, uiaa::SESSION_ID_LENGTH};
|
||||
|
|
@ -184,6 +185,11 @@ pub(crate) async fn handle_login(
|
|||
return Err!(Request(Unknown("User ID does not belong to this homeserver")));
|
||||
}
|
||||
|
||||
if services.users.is_login_disabled(&user_id).await {
|
||||
warn!(%user_id, "user attempted to log in with a login-disabled account");
|
||||
return Err!(Request(Forbidden("This account is not permitted to log in.")));
|
||||
}
|
||||
|
||||
if cfg!(feature = "ldap") && services.config.ldap.enable {
|
||||
match Box::pin(ldap_login(services, &user_id, &lowercased_user_id, password)).await {
|
||||
| Ok(user_id) => Ok(user_id),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue