From: Tom Hughes Date: Thu, 2 Oct 2014 12:36:46 +0000 (+0100) Subject: Ban usernames which match special URLs X-Git-Tag: live~5183 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/c83778df8ca3cb13aecaceab2a45b9c177b0331f Ban usernames which match special URLs Trac #5236 --- diff --git a/app/models/user.rb b/app/models/user.rb index 010cdf464..9c1d82ba8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -45,6 +45,7 @@ class User < ActiveRecord::Base validates_format_of :display_name, :with => /\A[^\x00-\x1f\x7f\ufffe\uffff\/;.,?%#]*\z/, :if => Proc.new { |u| u.display_name_changed? } validates_format_of :display_name, :with => /\A\S/, :message => "has leading whitespace", :if => Proc.new { |u| u.display_name_changed? } validates_format_of :display_name, :with => /\S\z/, :message => "has trailing whitespace", :if => Proc.new { |u| u.display_name_changed? } + validates_exclusion_of :display_name, :in => %w(new terms save confirm confirm-email go_public reset-password forgot-password suspended) validates_numericality_of :home_lat, :allow_nil => true validates_numericality_of :home_lon, :allow_nil => true validates_numericality_of :home_zoom, :only_integer => true, :allow_nil => true