feat(users): add ability to disable users without deleting them
- Add disabled boolean field to user schema (PostgreSQL, MySQL, SQLite) - Block disabled users from logging in via any auth provider (credentials, LDAP, OIDC) - Check disabled status in session callback to prevent session replay - Add changeDisabled API endpoint (admin-only) - Include disabled field in getById and getAll user endpoints - Add disable/enable user toggle in admin UI with status badge in user list
This commit is contained in:
1 parent
a55dc98487
commit
4ff2c9a7fb
13 files changed
+125
-1
No files matched your search
@@ -23,6 +23,11 @@ export const authorizeWithBasicCredentialsAsync = async (
|
||||
return null;
|
||||
}
|
||||
|
||||
if (user.disabled) {
|
||||
logger.warn("User is disabled", { userName: user.name });
|
||||
return null;
|
||||
}
|
||||
|
||||
logger.info("User is trying to log in. Checking password...", { userName: user.name });
|
||||
const isValidPassword = await comparePasswordsAsync(credentials.password, user.password);
|
||||
|
||||
|
||||
Reference in new issue
Block a user