FAQ
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 => $c->req->params->{'username'},
password => $c->req->params->{'password'},
status => [ '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/f4398fa7/attachment.htm

Search Discussions

  • Caleb Cushing at Mar 27, 2010 at 6:16 am

    On Fri, Mar 26, 2010 at 2:33 PM, Michael Peck wrote:
    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?
    I'm personally not sure I'd consider that normalized since a user
    could be all 3. I'd have a boolean and 3 columns, and I think it'd be
    more normalized. then you can just check the bool. although I'm not
    sure why you want to check any of those at authentication. One of the
    only other fields I check is a boolean 'enabled' because I want to be
    able to disable user accounts, and a disabled account can't
    authenticate. also if a users's status is 'logged in' why are we
    logging them in again?

    I post apologize because I don't actually know how to do what you are
    trying to do... but I suppose I commented because I even less
    understand why.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedMar 26, '10 at 6:33p
activeMar 27, '10 at 6:16a
posts2
users2
websitecatalystframework.org
irc#catalyst

2 users in discussion

Caleb Cushing: 1 post Michael Peck: 1 post

People

Translate

site design / logo © 2022 Grokbase