Improved server nickname validation

This commit is contained in:
2022-03-23 23:04:03 -05:00
parent 4e0b013a93
commit 4e469cb12c
2 changed files with 32 additions and 2 deletions

View File

@@ -448,7 +448,11 @@ class W3DHub
prefill: Store.settings[:server_list_username],
accept_callback: accept_callback,
cancel_callback: cancel_callback,
valid_callback: proc { |entry| entry.length.positive? }
# See: https://gitlab.com/danpaul88/brenbot/-/blob/master/Source/renlog.pm#L136-175
valid_callback: proc do |entry|
entry.length > 1 && entry.length < 30 && (entry =~ /(:|!|&|%| )/i).nil? &&
(entry =~ /[\001\002\037]/).nil? && (entry =~ /\\/).nil?
end
)
end