bad locale files could lead to broken automatic groups

This commit is contained in:
Sam 2013-06-23 14:44:16 +10:00
parent 298949a343
commit 287d0dbd75

View file

@ -36,6 +36,12 @@ class Group < ActiveRecord::Base
group.name = I18n.t("groups.default_names.#{name}")
# don't allow shoddy localization to break this
validator = UsernameValidator.new(group.name)
unless validator.valid_format?
group.name = name
end
real_ids = case name
when :admins
"SELECT u.id FROM users u WHERE u.admin"