Added funcitionality so user can change the email address associated with their accou...
[selectricity-live] / app / models / user.rb
index 728ca164eee7fa87868f6fdb5fe1ba749440bcf5..13588402064c996a69e018283ffa1dc5f4a63f61 100644 (file)
@@ -1,3 +1,10 @@
+# Selectricity: Voting Machinery for the Masses
+# Copyright (C) 2007, 2008 Benjamin Mako Hill <mako@atdot.cc>
+# Copyright (C) 2007 Massachusetts Institute of Technology
+#
+# This program is free software. Please see the COPYING file for
+# details.
+
 require 'digest/sha1'
 class User < ActiveRecord::Base
   has_many :elections
@@ -18,6 +25,10 @@ class User < ActiveRecord::Base
   def name
      [ firstname, lastname].join(" ")
   end
+  
+  def email=(new_email)
+    self[:email] = new_email
+  end
 
   # Authenticates a user by their login name and unencrypted password.  Returns the user or nil.
   def self.authenticate(login, password)
@@ -75,4 +86,5 @@ class User < ActiveRecord::Base
       errors.add(:login, "should not begin or end with spaces") if login and login.strip!
       errors.add(:login, "should contain only letters, numbers, and spaces") unless login =~ /^[A-Za-z0-9 ]*$/
     end
+    
 end

Benjamin Mako Hill || Want to submit a patch?