Re: [Catalyst] Auth tutorial merry-go-round

2008-07-07 Thread Ash Berlin

On 7 Jul 2008, at 09:40, Dermot wrote:


Hi,

I have been following the tutorial and am stuck in a loop. In my Root
controller I have the following

sub auto : Private {
  my ($self,$c) = @_;
  if ($c-controller eq $c-controller('Login')) {
   return 1;
  }
  if (!$c-user_exists) {
   $c-log-debug('***Root::auto User not found, forwarding to / 
login');

   $c-response-redirect($c-uri_for('/login'));
   return 0;
  }
# user found
  return 1;
}

In my Login controller I have

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
   $c-log-debug(User=$username, Password=$password);
   if ($c-authenticate({ username = $username,password =
$password} ) ) {
# If successful, then let them use the application
   $c-log-debug(Login Success);
   $c-response-redirect($c-uri_for('/books/list'));
   return;
} else {
# Set an error message
   $c-stash-{error_msg} = Bad username or password.;
}
}
# If either of above don't work out, send to the login page
   $c-stash-{template} = 'login.tt2';
}


When i login I see these debug messages

[debug] Path is login
[debug] User=admin, Password=admin
[debug] Created session 0628e51d5825d7309fd64a2404dd907bbea0ae27
[debug] Login Success
...
. 
+---.
| Action |  
Time  |
+ 
+---+
| /auto  |  
0.000649s |
| /login/index   |  
0.032623s |

| /end
...
[debug] GET request for books/list from 127.0.0.1
[debug] Path is books/list
[debug] ***Root::auto User not found, forwarding to /login
[debug] Redirecting to http://localhost:3000/login;

So while $c-authenticate can see my login in my Login controller, it
can't in Root/auto !!!  Can anyone point tell where I am going wrong?
TIA,
Dp.




What session store and state modules are you using? I know this  
happens to me when I forget to load up memcached (which is the store  
module i'm using)


-ash


___
List: Catalyst@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/


Re: [Catalyst] Auth tutorial merry-go-round

2008-07-07 Thread Dermot
2008/7/7 Ash Berlin [EMAIL PROTECTED]:
 On 7 Jul 2008, at 09:40, Dermot wrote:


 What session store and state modules are you using? I know this happens to
 me when I forget to load up memcached (which is the store module i'm using)

 -ash


These are the plugins I am currently using.

__PACKAGE__-setup(qw/-Debug
ConfigLoader
Static::Simple
StackTrace
Authentication
Authorization::Roles
Authorization::ACL
Session::State
Session::Store
Session::Store::FastMmap
Session
/);

Do you think there is something I should add to this list?
Dp.

___
List: Catalyst@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/


Re: [Catalyst] Auth tutorial merry-go-round

2008-07-07 Thread Dermot
2008/7/7 Ash Berlin [EMAIL PROTECTED]:

 On 7 Jul 2008, at 10:24, Dermot wrote:

 2008/7/7 Ash Berlin [EMAIL PROTECTED]:

 On 7 Jul 2008, at 09:40, Dermot wrote:

 Yes. You most likely want Catalyst::Plugin::Session::State::Cookie so that
 the session ID will get stored in a cookie.

That's done the trick. Thanx Ash.
Dp.

___
List: Catalyst@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/