I am using the authentication example of Rails Recipes book (around
page 135)
I am trying to make a sign-up form for it
I have the following method
def password=(pass)
salt=[Array.new(6){rand(256).chr}.join].pack("m").chomp
self.password_salt, self.password_hash = salt,
Digest::SHA256.hexdigest(pass + salt)
end
which seems to work
I use
attr_accessor :password
So that I can have a password field on my form
But if I use validates_length_of :password, :within => 5..40
The password always fails the validation even if I enter more that 5
chars etc...
Any help would be appreciatted
Thanks
Richard
Japan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---