My problem is that when inserting data into my database, I want to  
encrypt the password, from the plain text one that the user inputs to  
one encrypted with SHA1 and a salt. However when I try and replace  
@seller.password, with my new encrypted password the save fails.
Can anyone tell me how to correct this? Or make it work.
And before anyone asks, yes some of this code is shamelessly lifted  
from the Salted Login Generator.
controller.rb
def signup2
     @seller = Seller.new(params[:seller])
     @seller.salt = @seller.generate_salt
     @seller.password = @seller.encrypt_password(@seller.password,  
@seller.salt)
     if @seller.save
       flash["notice"] = "User account created."
       redirect_to(:controller => ''sellers'', :action =>
''signup'')
     else
       flash["notice"] = "Saving failed."
       redirect_to(:controller => ''sellers'', :action =>
''signup'')
     end
   end
model.rb
def generate_salt()
     salt = self.class.hashed("#{Time.now}}")
     return salt
   end
   def encrypt_password(password, salt)
     return self.class.hashed(salt + password)
   end
   def self.hashed(str)
     return Digest::SHA1.hexdigest("#{str}")[0..39]
   end
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails