diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 9c68ff0aa..73fe50a3a 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.62 2008-08-27 00:39:03 francis Exp $ +# $Id: user.rb,v 1.63 2008-08-27 00:52:07 francis Exp $ require 'digest/sha1' @@ -53,6 +53,12 @@ class User < ActiveRecord::Base "user" end + def after_initialize + if self.admin_level.nil? + self.admin_level = 'none' + end + end + 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) @@ -153,7 +159,7 @@ class User < ActiveRecord::Base u.save! end - return + return u end # Does the user magically gain powers as if they owned every request? |