From: Tom Hughes Date: Mon, 11 Jun 2007 08:43:47 +0000 (+0000) Subject: Don't allow [/;.,?] to be used in display names, as those are used as X-Git-Tag: live~8395 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/0d597c1771dce91ee2880ef946f5a9976c6e10d1 Don't allow [/;.,?] to be used in display names, as those are used as separator characters by rails when routing, which means a display name containing them will not work as part of a URL. --- diff --git a/app/models/user.rb b/app/models/user.rb index 7b57b8710..d6cff0f25 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -13,6 +13,7 @@ class User < ActiveRecord::Base validates_length_of :pass_crypt, :minimum => 8 validates_length_of :display_name, :minimum => 3, :allow_nil => true validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i + validates_format_of :display_name, :with => /^[^\/;.,?]*$/ before_save :encrypt_password