[Catalyst] Userpasswords

Jonathan Rockway jon at jrock.us
Thu May 22 21:31:14 BST 2008


* On Thu, May 22 2008, J. Shirley wrote:
> On Thu, May 22, 2008 at 12:48 PM, Stephan Jennewein <xt3 at cccmz.de> wrote:
>> Hi,
>>
>> what's the common way to add user with encrypted passwords with the algorithm
>> i've chosen in the config . There are nice plugins for authenticating users
>> but no for create new users. I tried to write a hook for the schema, but it
>> won't work. Can anyone give me a working solution ?
>>
>> Stephan
>>
>
> That depends how you are storing the users, which you didn't really explain.
>
> I'll just assume that you are using
> Catalyst::Authentication::Store::DBIx::Class and have a DBIx::Class
> schema class that you store your users in.
>
> If that assumption is correct, simply use DBIx::Class::EncodedColumn
>
> http://search.cpan.org/~groditi/DBIx-Class-EncodedColumn-0.00001/lib/DBIx/Class/EncodedColumn.pm

As an aside, here's the script I use for creating password hashes (using
EncodedColumn and Bcrypt):

    use strict;
    use warnings;
    use DBIx::Class::EncodedColumn::Crypt::Eksblowfish::Bcrypt;    
    use Term::ReadLine;

    chomp(my $password = Term::ReadLine->new($0)->readline('Password> '));    
    print DBIx::Class::EncodedColumn::Crypt::Eksblowfish::Bcrypt->
              make_encode_sub->($password), "\n";

Yes, the password is echoed.

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"



More information about the Catalyst mailing list