[Catalyst] problem with Authentication::CDBI

Srinivasa Mullangi mullangi at rocketmail.com
Thu Jun 2 05:22:14 CEST 2005


It is working after 'sub login'  moved to controller MyApp::C::Login
I appreciate your help. Thanks a lot.

michael reece <mreece at sacbee.com> wrote:
i ran into this, too. putting your 'sub login' in your app causes it 
to conflict with the login sub that is imported from the Auth::CDBI 
plugin.

put it in MyApp::C::Login as sub login : Global, and then $c->forward 
('/login/login')

(or call it signin instead of login, if it must live in MyApp. but 
you'll run into this with any sub name that conflicts with any sub 
name on any plugin, so get used to separate controllers)


On Jun 1, 2005, at 12:19 PM, Srinivasa Mullangi wrote:

> Hi,
>
> I am trying to implement 'Authentication with 
> Catalyst::Plugin::Authentication::CDBI' example from the cook book.
>
> Here is my config and code
> authentication => { user_class => 'User',
> user_field => 'email',
> password_field => 'password',
> role_class => 'Roles',
> &! nbsp; user_role_class => 'UserRoles',
> user_role_user_field => 'user_id',
> user_role_role_field => 'role_id',
> },
> sub begin : Private {
> my ( $self, $c ) = @_;
> unless ($c->req->{user}) {
> $c->req->action(undef);
> $c->forward('/login');
> }
> }
> my $loginprofile = {
> required => [qw(username password)],
> };
>
> sub login : Local {
> my ($self, $c) = @_;
> $c->stash->{template} = 'template/login.tt';
> if($c->req->params->{submit}) {
> my $results = Data::FormValidator->check($c->req- 
> >params, $loginprofile);
> if($results->has_missing() || $results->has_invalid 
> ()) {
> $c->stash->{error} = 'Error in the 
> submitted data';
> $c->stash->{results} = $results;
> return;
> }
> $c->session_login($c->req->params->{username}, $c- 
> >req->params->{password});
> if ($c->req->{user}) {
> $c->forward('/');
> }
> }
> }
>
> I created an user with email: 'mullangi at rocketmail.com' and 
> password 'abcde'.
> I am getting the following error from the method $c->session_login 
> (...)
>
> [Wed Jun 1 10:45:27 2005] [catalyst] [error] Caught exception 
> "Can't locate object method "log" via package 
> "mullangi at rocketmail.com" (perhaps you forgot to load 
> "mullangi at rocketmail.com"?) at /var/www/BettyMills-Admin/script/../ 
> lib/BettyMills/Admin.pm line 54."
> Please advise on what is going wrong and how to fix.
>
> Thanks
> Srini
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>


		
---------------------------------
Discover Yahoo!
 Stay in touch with email, IM, photo sharing & more. Check it out!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20050601/6fd2964e/attachment.htm


More information about the Catalyst mailing list