[Catalyst] Authentication::Store::DBIC => Can't call method "search" in uthentication::Store::DBIC::User ???
T. H. Lin
easy.lin at gmail.com
Sun Apr 23 02:06:37 CEST 2006
It seems
__PACKAGE__->config->{authentication}{dbic} = {
user_class => 'DBIC::User',
user_field => 'name',
password_field => 'pass',
password_type => 'hashed',
password_hash_type => 'SHA-256',
};
must be defined in MyApp.pm(and before __PACKAGE__->setup !!)
but....
I have 2 tables for two different type of account,
(for some reason, I make 2 tables, do not use role method)
MyApp/C/basic_account.pm
MyApp/C/advanced_account.pm
I would like to define different user_class in basic_account.pm and
advanced_account.pm.
is it possible?
On 23/04/06, T. H. Lin <easy.lin at gmail.com> wrote:
> MyApp.pm
> =========
> use Catalyst qw/-Debug
> ConfigLoader
> Static::Simple
> DefaultEnd
> Authentication
> Authentication::Store::DBIC
> Authentication::Credential::Password
> I18N/;
> __PACKAGE__->setup;
> ======================
>
> MyApp/Controller/Login.pm
> ======================
> sub begin : Private {
> my ( $self, $c ) = @_;
> $c->config->{authentication}{dbic} = {
> user_class => 'DBIC::User',
> user_field => 'name',
> password_field => 'pass',
> password_type => 'hashed',
> password_hash_type => 'SHA-256',
> };
> }
> sub default : Private {
> my ( $self, $c ) = @_;
>
> if ( my $user = $c->req->param("user")
> and my $password = $c->req->param("password") )
> {
> if ( $c->login( $user, $password ) ) {
> $c->res->body( "hello " ) . $c->user->name );
> } else { ... }
> }
> else { .. }
> }
> =========================================
>
> then I connect to /account
> ERROR
> Caught exception in MyApp::Controller::Account->default "Can't call
> method "search" on an undefined value at
> /usr/local/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/Authentication/Store/DBIC/User.pm
> line 15."
>
> ??why Catalyst/Plugin/Authentication/Store/DBIC/User.pm ??
> I see the code, there is something like... $config->{auth}
>
> I try to dump my $c->config
> $c->config->{auth} is undef!
>
More information about the Catalyst
mailing list