[Catalyst] DBIC Authentication Errors

J. Shirley jshirley at gmail.com
Wed Sep 24 23:40:21 BST 2008


On Wed, Sep 24, 2008 at 2:52 PM, Greg Coates <gcoates at csuchico.edu> wrote:
> I'm getting errors when I try to login to my web app, which is set up to use
> the DBIC authentication plugin.
>
>
>
> Here's the relevant portion of my config file:
>
> authentication:
>  default_realm: dbic
>  realms:
>    dbic:
>      credential:
>        class: Password
>        password_field: usr_password
>        password_type: clear
>      store:
>        class: DBIx::Class
>        user_class: BlogDB::Users
>        id_field: usr_login_name
>
>
>
> When I start the dev server, I see this:
> [debug] Loaded Config "/path/to/my/config/dev.yml"
> [debug] Setting up auth realm dbic
>
>
>
> Here's the login controller:
>
> sub login : Local {
>  my ($self, $c) = @_;
>
>  if ($c->request->params->{submitted} eq 'yes') {
>    my $username = $c->request->params->{usr_login_name} || "";
>    my $password = $c->request->params->{usr_password} || "";
>    if ($c->authenticate({ username => $username,
>                           password => $password })) {
>      $c->response->redirect( $c->uri_for('/posts') );
>      return;
>    } else {
>      $c->stash->{message} = "Invalid user ID or password.";
>    }
>  }
>
>  $c->stash->{template} = 'users/login.tt';
>  $c->stash->{stylesheet} = 'form.css';
> }
>
>
> The login form displays fine, but when I try to log in using a uid/password
> combo that IS in the database, I get this error:
>
> [debug] "POST" request for "users/login"
> [debug] Path is "users/login"
> [error] Caught exception in MyApp::Controller::Users->login "User retrieval
> failed: no columns from BlogDB::Users were provided at
> /usr/lib/perl5/site_perl/5.8.5/Catalyst/Authentication/Store/DBIx/Class.pm
> line 63"
>
>
> I've googled for solutions until my fingertips are numb with no luck.  I
> suspect there's some stupid little problem that I'm missing.  Can anyone
> shed some light on this issue for me?
>
> Thanks,
> Greg
>

You probably want $c->authenticate({ usr_login_name => $username,
usr_password => $password });

The parameters passed into authenticate match what your DBIC schema
class declares.

-J



More information about the Catalyst mailing list