aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2008-05-11 23:47:07 +0000
committerfrancis <francis>2008-05-11 23:47:07 +0000
commit50fc963cd136c794e6227ae00a778abdac57090b (patch)
tree4502abac7bc9051b7acbea907b33609160065499
parent6513d9eecefca2ce9f208e580515408acd81c9cc (diff)
Don't allow emails in name field
-rw-r--r--app/models/user.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 9042fda26..a7e1733ae 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -21,7 +21,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user.rb,v 1.52 2008-04-24 23:52:59 francis Exp $
+# $Id: user.rb,v 1.53 2008-05-11 23:47:07 francis Exp $
require 'digest/sha1'
@@ -50,6 +50,9 @@ class User < ActiveRecord::Base
def validate
errors.add(:email, "doesn't look like a valid address") unless MySociety::Validate.is_valid_email(self.email)
+ if MySociety::Validate.is_valid_email(self.name)
+ errors.add(:name, "^Please enter your name, not your email address, in the name field.")
+ end
end
# Don't display any leading/trailing spaces