[Catalyst] Authentication with Catalyst::Authentication::Store::DBIx::Class

Michael Peck mapeck65 at gmail.com
Fri Mar 26 18:33:21 GMT 2010


I have a question regarding authentication using
Catalyst::Authentication::Store::DBIx::Class, that I'm sure someone here can
answer.  Please excuse me, as I am a complete catalyst and DBIx::Class n00b.

Catalyst::Authentication::Store::DBIx::Class uses the following example:

    if ($c->authenticate({
                          screen_name =3D> $c->req->params->{'username'},
                          password =3D> $c->req->params->{'password'},
                          status =3D> [ 'registered', 'active', 'loggedin']
                         })) {

        # ... authenticated user code here
    }


In this example, if the entered username and password match AND the status
column matches one of the specified values: 'registered', 'active', or
'loggedin', then the user is authenticated.

I prefer to have a list of valid statuses, and a more normalized database.
What if, in the database, we have a table of statuses, such as:

id | status
1  | registered
2  | active
3  | loggedin
...

...and we store the status id in our user model...how would I handle the
authenticate method call?

Thanks,
Mike Peck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100326/f4398=
fa7/attachment.htm


More information about the Catalyst mailing list