ignore deactivated users and remote user profiles wih forbidden_usernames
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
@@ -933,8 +933,13 @@ impl KeyValueDatabase {
|
|||||||
{
|
{
|
||||||
let patterns = &services().globals.config.forbidden_usernames;
|
let patterns = &services().globals.config.forbidden_usernames;
|
||||||
if !patterns.is_empty() {
|
if !patterns.is_empty() {
|
||||||
for user in services().users.iter() {
|
for user_id in services()
|
||||||
let user_id = user?;
|
.users
|
||||||
|
.iter()
|
||||||
|
.filter_map(std::result::Result::ok)
|
||||||
|
.filter(|user| !services().users.is_deactivated(user).unwrap_or(true))
|
||||||
|
.filter(|user| user.server_name() == services().globals.server_name())
|
||||||
|
{
|
||||||
let matches = patterns.matches(user_id.localpart());
|
let matches = patterns.matches(user_id.localpart());
|
||||||
if matches.matched_any() {
|
if matches.matched_any() {
|
||||||
warn!(
|
warn!(
|
||||||
|
|||||||
Reference in New Issue
Block a user