Pregunta

I am trying to setup Catalyst for the first time. After debugging for quite sometime to figure out why authentication won't work, realized that the sql query looks like

SELECT me.user_id, me.password, me.role FROM users me WHERE ( password = ? ): 'abcd'

the users table ( for the testing pwd is clear text )

user_id PRI password role

Users.pm has PACKAGE->set_primary_key("user_id");

What could be wrong that the query is on password and not on the user_id ?

Thanks

¿Fue útil?

Solución

It sounds like the configuration hash is not constructed correctly.

I would suggest the id_field is pointing to password instead of user_id. Here's the config from my app (I use Class:DBI, not DBIx::Class which you probably are, but that's not significant). login_name is my equivalent of your user_id, i.e. the field that the user-id is stored in:

my $authenticationconfig = {
    default_realm => 'login_name',

    login_name => {
        credential => {
            class => 'Password',
            password_field => 'password',
            password_type => 'crypted'
        },
        store => {
            class => 'Class::DBI',
            user_class => '__myapp__::__myusertable__',
            id_field => 'login_name' ## have you got password here?
        }
    },
    ... # other realms
};
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top