Re: problems creating a simple auth, please help.

Frederick Cheung
2008-03-17T18:02:16Z

On 17 Mar 2008, at 17:28, ReK2 wrote:

>
> Hi, I am new to ruby/rails. learning fast but still getting stuck on
> key
> places..
> so I have a db and a column called email and crypt one is obviously
> the
> email of the users and the other the password column.
> so I have this controller for the main application controller:

>               salt = [Array.new(6)
> {rand(256).chr}.join].pack("m").chomp
>               expected_password = password.crypt(salt)
>               if Users.crypt != expected_password

Like I said the last time you asked, you can''t use a random salt like
that - you need to use the same salt as when you created the user
Users.crypt will try and call the crypt method on the Users class. I
suspect you actually want self.crypt (to get the value for that user).

Fred