Merge branch 'filter-spam-users' into 'master'
Do not allow spam users to be created See merge request nilsding/retrospring!68
This commit is contained in:
commit
07669d854f
|
@ -3,10 +3,14 @@ class ScreenNameValidator < ActiveModel::EachValidator
|
||||||
notifications inbox sign_in sign_up sidekiq moderation moderator mod administrator
|
notifications inbox sign_in sign_up sidekiq moderation moderator mod administrator
|
||||||
siteadmin site_admin help retro_spring retroospring retrosprlng niisding nllsding
|
siteadmin site_admin help retro_spring retroospring retrosprlng niisding nllsding
|
||||||
pixeidesu plxeldesu plxeidesu terms privacy)
|
pixeidesu plxeldesu plxeidesu terms privacy)
|
||||||
|
FORBIDDEN_SCREEN_NAME_REGEXPS = [/wreciap\z/i]
|
||||||
|
|
||||||
def validate_each(record, attribute, value)
|
def validate_each(record, attribute, value)
|
||||||
if FORBIDDEN_SCREEN_NAMES.include? value.downcase
|
if FORBIDDEN_SCREEN_NAMES.include? value.downcase
|
||||||
record.errors[attribute] << "Thou shalt not use this username! Please choose another one."
|
record.errors[attribute] << "Thou shalt not use this username! Please choose another one."
|
||||||
end
|
end
|
||||||
|
if FORBIDDEN_SCREEN_NAME_REGEXPS.any? { |regexp| value.downcase =~ regexp }
|
||||||
|
record.errors[attribute] << "Registration is tempoarily disabled for new users."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue