Add ability to block words in usernames (#35407)

This commit is contained in:
Eugen Rochko authored and GitHub committed 2025-07-29 10:19:15 +00:00
1 parent 8cf7a77808
commit 20bbd20ef1
28 files changed
+560 -34

No files matched your search

@@ -28,14 +28,6 @@ class UnreservedUsernameValidator < ActiveModel::Validator
end
def settings_username_reserved?
settings_has_reserved_usernames? && settings_reserves_username?
end
def settings_has_reserved_usernames?
Setting.reserved_usernames.present?
end
def settings_reserves_username?
Setting.reserved_usernames.include?(@username.downcase)
UsernameBlock.matches?(@username, allow_with_approval: false)
end
end