DBIx::Class::EncodedColumn looks really great and I am looking at putting it into a new project to handle the passwords but I seem to be stuck and wanted to report a typo in the Pod too.

"encode_check_method" is listed correct in SHA-1's synopsis sample but the MD5 and Eksblowfish (which is the one I'm trying to use) both list it as "digest_check_method" which doesn't exist but "encode_check_method" does and is in the tests. Trailing close parens are missing too.

So, in my user class I've got this. It is in a loader generated schema so it appears after the # DO NOT MODIFY THIS OR ANYTHING ABOVE!

__PACKAGE__->add_columns(
                         'password' => {
                             data_type => 'VARCHAR',
                             is_nullable => 1,
                             size      => 60,
                             encode_column => 1,
encode_class => 'Crypt::Eksblowfish::Bcrypt', encode_args => { key_nul => 0, cost => 8 },
                             encode_check_method => 'check_password',
                             });

I did try the size of "22" as the docs show but it didn't work either and the hash result is "60" long so (adjusting in the DB too, hence the loader stuff so this can be tweaked over and over).

In my Cat app I'm trying to do this:

        my $username = $form->param("username");
        my $password = $form->param("password");

my $user = $c->model("DBIC::User")->find({ username => $username });

my $enc = DBIx::Class::EncodedColumn::Crypt::Eksblowfish::Bcrypt->
            make_encode_sub("$password", { key_nul => 0, cost => 8 });

$c->log->error( "GOOD? " . ( $user->check_password ($password) ? "YES!" : "NO" ) );
        $c->log->warn( $enc->($password) );
        $c->log->warn( $user->password );

And seeing this in the log:
[error] GOOD? NO
[warn] $2$08$ezi1tkZgNE3s5vTcK7d4SeyevlXy.L/2mHX0a07AlXV3ONdqkUo5S
[warn] $2$08$EaoTBR7W4akZiofOrrRnA.P5.Bwav85xevEWY4cky94yxxrP2uWU6

What am I doing (or assuming) wrong?

Thanks!

-Ashley


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to