2015-01-09 05:12:52 -08:00
|
|
|
class ScreenNameValidator < ActiveModel::EachValidator
|
|
|
|
FORBIDDEN_SCREEN_NAMES = %w(justask_admin retrospring_admin admin justask retrospring support about public
|
|
|
|
notifications inbox sign_in sign_up sidekiq moderation moderator mod administrator
|
2015-01-16 14:31:02 -08:00
|
|
|
siteadmin site_admin help retro_spring retroospring retrosprlng niisding nllsding
|
|
|
|
pixeidesu terms privacy help)
|
2015-01-09 05:12:52 -08:00
|
|
|
|
|
|
|
def validate_each(record, attribute, value)
|
|
|
|
if FORBIDDEN_SCREEN_NAMES.include? value.downcase
|
|
|
|
record.errors[attribute] << "Thou shalt not use this username! Please choose another one."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|