mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Add support for username regex.
This commit is contained in:
@@ -162,7 +162,7 @@ class User < ActiveRecord::Base
|
||||
lower = username.downcase
|
||||
|
||||
User.where(username_lower: lower).blank? &&
|
||||
!SiteSetting.reserved_usernames.split("|").any? { |reserved| reserved.casecmp(username) == 0 }
|
||||
SiteSetting.reserved_usernames.split("|").all? { |reserved| !lower.match('^' + Regexp.escape(reserved).gsub('\*', '.*') + '$') }
|
||||
end
|
||||
|
||||
def self.plugin_staff_user_custom_fields
|
||||
|
||||
Reference in New Issue
Block a user