On Tue, Mar 17, 2009 at 3:14 AM, fREW Schmidt <[email protected]> wrote: > Hi! > We are trying to use CAP::Authentication and in general it works fairly > well. I am trying to make a new LOGIN_RUNMODE though and it just doesn't > seem to work. > > Here's my code: > > __PACKAGE__->authen->config( > DRIVER => [ 'Generic', { user1 => '123' } ], > LOGIN_RUNMODE => 'login', > ); > > __PACKAGE__->authen->protected_runmodes(qr/^(?!main)/); > > sub login : Runmode { > my $self = shift; > $self->header_add( -status => '500 unauthenticated' ); > return $self->json_body({ success => 'false', reason => > 'unauthenticated'}); > } > > > Clearly I am not doing anything very special, but for some reason I am > getting a 404 error. I tried all of these: > > LOGIN_RUNMODE => 'login', > LOGIN_RUNMODE => 'controller/login', > LOGIN_RUNMODE => '/controller/login', > LOGIN_RUNMODE => '/ACD/controller/login',
Getting a 404 with the LOGIN_RUNMODE option sounds very strange. All the LOGIN_RUNMODE option does is change the current runmode to what you specified if the user is not authenticated (search for the 'redirect_to_login' method in the code). That means that in the current application you need a 'login' runmode which returns your login form (and it looks like you have that). Perhaps you are already doing some runmode manipulation at the prerun level which is conflicting. How are you managing the path_info to get your runmode? Are you using Dispatch, or the built in CGI::Application support, or your own home rolled solution? You can also get to a custom login page by providing a url which will do a redirect to the new page, so maybe the following will work for you: LOGIN_URL => '/ACD/controller/login', Cheers, Cees ##### CGI::Application community mailing list ################ ## ## ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ## ## ## ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ## ## ################################################################
