Also, as a by the by, why restrict the password to less than 10 characters in length? The storage cost is the same, and since most of the time the bcrypt algorithm will be operating on some hashed version of the password anyway, the computational cost will also be negligibly different.
Regards Jonathan On 19 August 2011 16:34, joe <[email protected]> wrote: > Oops, didn't see this until after I responded. Yes, this is the > approach I took more or less. Thanks! > > On Aug 19, 10:23 am, Jonathan Stott <[email protected]> wrote: >> Hi Joe >> >> I think the best way to handle this is probably by making the password >> an accessor and having a different property for the password in the >> DB. You can then try something likehttps://gist.github.com/1039058 >> or alternatively: >> >> attr_reader :password >> >> property :encrypted_password, BCryptHash, :required => true >> >> validates_presence_of :password >> >> def password=(password) >> self.encrypted_password = passwoard >> @password = password >> end >> >> Regards >> Jonathan >> >> On 18 August 2011 15:29, joe <[email protected]> wrote: >> >> > If I have a BCryptHash property, e.g., >> > property :password, BCryptHash, :length => 6..8 >> > then it appears that the length validation is run after the password >> > is converted to a hash and always fails. Is there a mechanism for >> > doing this? >> >> > Thanks. >> >> > Joe >> >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "DataMapper" group. >> > To post to this group, send email to [email protected]. >> > To unsubscribe from this group, send email to >> > [email protected]. >> > For more options, visit this group >> > athttp://groups.google.com/group/datamapper?hl=en. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "DataMapper" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/datamapper?hl=en. > > -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
