[Catalyst] Re: Using htpasswd file : New Issue

Rohan M rohan7799 at gmail.com
Tue May 31 09:40:52 GMT 2011


Hi John,

I'll give a try and post it after the successful run. Meanwhile, a
workaround , I used session to store db object for the user and used it.

thanks for the guidance..

Regards,
ROhan

On Tue, May 31, 2011 at 7:02 AM, John Romkey <romkey at romkey.com> wrote:

> On May 30, 2011, at 11:27 AM, Rohan M wrote:
>
> I got carried away with the other work for the same app. Now I'm back to
> this point again.
>
> I created a file called User.pm and put it under Model directory.
> After putting,  use base
> "Catalyst::Authentication::Store::Htpasswd::User";  I am trying to use
> around find_user or any method that is present in the base class but I en=
ded
> up getting following error.
>
> "Couldn't load class (MyApp) because: The method 'check_password' was not
> found in the inheritance hierarchy."
>
> I'm sorry to ask you again but I'm not sure how the following subclassing
> can be done.
>
> Could you send few more details ( example) ?
>
> =3D=3D=3D=3D
> package MyApp::Model::User;
> use Moose;
> use namespace::autoclean;
> use Switch;
> use base "Catalyst::Authentication::Store::Htpasswd::User";
> extends 'Catalyst::Model';
>
>
> around check_password =3D> sub {
>    my ($orig, $self, $authinfo, $c, @args) =3D @_;
>    my $user =3D $self->$orig($authinfo, $c, @args);
>    return $user;
> };
>
> OR
>
> around find_user =3D> sub {
>    my ($orig, $self, $authinfo, $c, @args) =3D @_;
>    my $user =3D $self->$orig($authinfo, $c, @args);
>    $user->extra_field($c->model('DB::User')->find({ username =3D> $user->=
id
> })->first->extra_field;
>    return $user;
> };
>
>
> Rohan,
>
> I haven't verified this but I think that what you want to do is make it be
> a regular class, not a Catalyst component. Then in your configuration whe=
re
> you specify your user_class for your store use MyApp::User rather than
> Catalyst::Authentication::Store::Htpasswd::User
>
> package MyApp::User;
> use Moose;
> use namespace::autoclean;
> extends 'Catalyst::Authentication::Store::Htpasswd::User';
>
> around check_password =3D> sub {
>    my ($orig, $self, $authinfo, $c, @args) =3D @_;
>    my $user =3D $self->$orig($authinfo, $c, @args);
>    return $user;
> };
>
> around find_user =3D> sub {
>    my ($orig, $self, $authinfo, $c, @args) =3D @_;
>    my $user =3D $self->$orig($authinfo, $c, @args);
>    $user->extra_field($c->model('DB::User')->find({ username =3D> $user->=
id
> })->first->extra_field;
>    return $user;
> };
>
>
> - john romkey
> http://www.romkey.com/
>
>
>
> _______________________________________________
> 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/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110531/a51b6=
8aa/attachment.htm


More information about the Catalyst mailing list