[Catalyst] "Can't call method "user_is_restorable"

Mark Beihoffer mbeihoffer at gmail.com
Tue Nov 25 20:35:58 GMT 2008


Here is my yml configuration file, which is currently *not* being
picked up by ConfigLoader, for some reason.

What can I do to get ConfigLoader to pick up this file? I have Debug
turned on so I can see it's not happening when the test server starts
up.

---
name: TCLegal
authentication:
    dbic:
        # Note this first definition would be the same as setting
        # __PACKAGE__->config->{authentication}->{dbic}->{user_class}
= 'TCLegalDB::User'
        # in lib/TCLegal.pm (IOW, each hash key becomes a "name:" in
the YAML file).
        #
        # This is the model object created by Catalyst::Model::DBIC from your
        # schema (you created 'TCLegalDB::User' but as the Catalyst startup
        # debug messages show, it was loaded as
'TCLegal::Model::TCLegalDB::User').
        # NOTE: Omit 'TCLegal::Model' to avoid a component lookup
issue in Catalyst 5.66
        user_class: TCLegalDB::User
        # This is the name of the field in your 'users' table that
contains the user's name
        user_field: username
        # This is the name of the field in your 'users' table that
contains the password
        password_field: password
        # Other options can go here for hashed passwords
        # Enabled hashed passwords
        password_type: hashed
        # Use the SHA-1 hashing algorithm
        password_hash_type: SHA-1
authorization:
    dbic:
        # This is the model object created by Catalyst::Model::DBIC from your
        # schema (you created 'TCLegalDB::Role' but as the Catalyst startup
        # debug messages show, it was loaded as
'TCLegal::Model::TCLegalDB::Role').
        # NOTE: Omit 'TCLegal::Model' to avoid a component lookup
issue in Catalyst 5.66
        role_class: TCLegalDB::Role
        # The name of the field in the 'roles' table that contains the role name
        role_field: role
        # The name of the accessor used to map a role to the users who
have this role
        # See the has_many() in TCLegalDB/Role.pm
        role_rel: map_user_role
        # The name of the field in the user_role table that references the user
        user_role_user_field: user_id




On Tue, Nov 25, 2008 at 12:22 PM, J. Shirley <jshirley at gmail.com> wrote:
> On Tue, Nov 25, 2008 at 9:35 AM, Mark Beihoffer <mbeihoffer at gmail.com> wrote:
>> Hello,
>>
>> I've encountered a problem with Catalyst::Plugin::Authentication
>> 0.10008 that I can't seem to resolve.
>>
>> When logging in or out now I get these error messages:
>>
>> Caught exception in TCLegal::Controller::Logout->index "Can't call
>> method "user_is_restorable" on an undefined value at
>> /usr/local/libdata/perl5/site_perl/Catalyst/Plugin/Authentication.pm
>> line 169."
>>
>> and
>>
>> An error has occurred. We're terribly sorry about that, but it's one
>> of those things that happens from time to time. Let's just hope the
>> developers test everything properly before release...
>>
>> Here's the error message, on the off-chance that it means something to
>> you: undef error - Can't call method "user_is_restorable" on an
>> undefined value at
>> /usr/local/libdata/perl5/site_perl/Catalyst/Plugin/Authentication.pm
>> line 169.
>>
>> What am I doing wrong? I've updated all the modules I can think of,
>> and nothing seems to fix this problem.
>>
>> It happens under mod_perl with an Apache Virtualhost configuration,
>> and also under the test server.
>>
>> >From myapp.conf
>>
>> use parent qw/Catalyst/;
>> use Catalyst qw/-Debug
>>                ConfigLoader
>>                Static::Simple
>>                StackTrace
>>
>>                Authentication
>>                Authorization::Roles
>>                Authorization::ACL
>>
>>                Session
>>                Session::Store::FastMmap
>>                Session::State::Cookie
>>
>>                /;
>>
>> and here's the code around my ->authenticate call:
>>
>> sub index :Path :Args(0) {
>>    my ($self, $c) = @_;
>>
>>    # Get the username and password from form
>>    my $username = $c->request->params->{username} || "";
>>    my $password = $c->request->params->{password} || "";
>>
>>    # If the username and password values were found in form
>>    if ($username && $password) {
>>        # Attempt to log the user in
>>        if ($c->authenticate({ username => $username,
>>                               password => $password} )) {
>>            # If successful, then let them use the application
>>            $c->response->redirect($c->uri_for('/'));
>>            return;
>>        } else {
>>            # Set an error message
>>            $c->stash->{error_msg} = "Bad username or password.";
>>        }
>>    }
>>
>>
>>
>> Thanks for any advice,
>>
>> - Mark Beihoffer
>>
>
> Hi Mark,
>
> Can you also send the related snippet from config (everything in the
> 'Plugin::Authentication' key)?
> That will tell us what store and credential you are using, so we don't
> have to guess :)
>
> The code to the authenticate call looks fine, so perhaps something in
> the config is the culprit.  Obviously we want the error messages to be
> more helpful, so I'd like to also solve why you aren't getting a
> helpful message, too.
>
> Thanks,
> -J
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>



More information about the Catalyst mailing list