diff --git a/app/models/user.rb b/app/models/user.rb index 18d803aa7..37d2e86bb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -11,7 +11,9 @@ class User < ActiveRecord::Base protected def generate_password - self.password = self.password_confirmation = Digest::MD5.hexdigest(Date.today.to_s)[0..6] + if self.password.blank? + self.password = self.password_confirmation = Digest::MD5.hexdigest(Date.today.to_s)[0..6] + end end def send_notification_email diff --git a/db/seeds.rb b/db/seeds.rb index d250f8187..496bd8f19 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -12,7 +12,7 @@ TEST_USERS.each do |tuser| next if User.find_by_email(email) name = tuser[1] pass = Digest::MD5.hexdigest(name)[0..6] - User.create! :name => name, :email => email, :password => pass, :password_confirmation => pass + user = User.create! :name => name, :email => email, :password => pass, :password_confirmation => pass puts "Created user #{name} (#{email}) and password #{pass}" end