[Catalyst] Userpasswords

2008-05-22 Thread Stephan Jennewein
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

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Userpasswords

2008-05-22 Thread J. Shirley
On Thu, May 22, 2008 at 12:48 PM, Stephan Jennewein [EMAIL PROTECTED] 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.1/lib/DBIx/Class/EncodedColumn.pm

-J

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Userpasswords

2008-05-22 Thread Jonathan Rockway
* On Thu, May 22 2008, J. Shirley wrote:
 On Thu, May 22, 2008 at 12:48 PM, Stephan Jennewein [EMAIL PROTECTED] 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.1/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 $,=$

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/