[Catalyst] password and Catalyst::Plugin::Authentication::CDBI

Vlad Bazon vlad.bazon at gmail.com
Fri Sep 30 19:13:43 CEST 2005


{
package SitSco::M::Diriginti;
use base 'SitSco::M::Situatii';
__PACKAGE__->table ('diriginti');
__PACKAGE__->columns(All => qw/id sc_id clasa nume pren username parola/);
__PACKAGE__->columns( Essential => qw/clasa nume pren username parola/ );
__PACKAGE__->columns( Stringify => qw/clasa nume pren/ );
__PACKAGE__->has_many(elevi => 'SitSco::M::Elevi' => 'di_id');
__PACKAGE__->has_a(sc_id => 'SitSco::M::Scoli');

__PACKAGE__->add_trigger(before_create =>
sub { my ($self) = @_;
my $pa = $self->parola;
$self->parola(make_passw($pa));
});

sub make_passw {
my ($p) = @_;
my $md5 = new Digest::MD5;
$md5->add($p);
return $md5->hexdigest;
}

sub check_passw {
my ($self, $dir, $pa) = @_;
if (!defined $pa) {
$pa = '';
}
my $md5 = make_passw($pa);
my @rec = $self->search(id => $dir, parola => $md5);
if (scalar @rec) {
return $rec[0];
}
return undef;
}

}


On 9/29/05, Sai Tong <stong at fidelio.rutgers.edu> wrote:
>
>
> How does one generate password to use with authentication by
>
> Catalyst::Plugin::Authentication::CDBI
>
> ?
>
> Is the password stored as encrypted text in the corresponding database
> table (Model)?
>
>
>
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20050930/547d1d43/attachment-0001.htm


More information about the Catalyst mailing list