[Catalyst] Authentication hashing

Kevin Old kevinold at gmail.com
Mon Jan 2 00:06:50 CET 2006


Hello everyone,

Happy New Year!  I have resently begun integrating
Catalyst::Plugin::Authentication::Store::DBIC into an app I'm working
on.  I've configured the authentication just like the POD example. 
Below is what I use to create a new user in the database via the
Authentication::Store::DBIC module, but it does not encrypt the
password.  I have the lines:

password_type      => 'hashed',
password_hash_type => 'SHA-1',

in my __PACKAGE__->config->{authentication}->{dbic} hash (as stated
before I use the example in the POD), but the password in the database
is stored in cleartext.

Here's what I use to insert a new user:

sub createuser : Local {
    my ( $self, $c ) = @_;

    if (    my $username = $c->req->param("username")
        and my $password = $c->req->param("password")
        and my $other = $c->req->param("other") )
    {
        my %user = (
            username => $username,
            password => $password,
            other => $other,
        );

        # Create the object
        my $new_user = BIOAdmin::Model::BIOAdminDB::User->new(\%user);

        # Insert the user
        $new_user->insert_or_update;
    }
}

How do I get the password type applied to $c->req->param("password")? 
I read all of the docs for the module and searched the archive and
couldn't figure it out.

Any help is appreciated,
Kevin
--
Kevin Old
kevinold at gmail.com



More information about the Catalyst mailing list