ignore deactivated users and remote user profiles wih forbidden_usernames
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
3ac5368578
commit
41d9e24c03
1 changed files with 7 additions and 2 deletions
|
@ -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!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue