On 5/22/06, Simon Rees <[EMAIL PROTECTED]> wrote:
I'm using CGI::Application::Plugin::Authentication in my web application and
have found it useful but I'm stuck on a good way to implement some
functionality I need.

After a user has submitted their registration details I need to Authenticate
them straight away. The registration form contains a number of fields
including their chosen username and password which is submitted to a
CGI::App runmode where the data is validated and inserted into the
database.
The problem is that CGI::Application::Plugin::Authentication::initialize has
already been executed by the time this occurs.

Any ideas on how I could do this? I'm currently redirecting after processing
the registration data with the credentials in the query string - but I'm
not terribly comfortable with this solution...

You could call 'initialize' yourself after the user has signed up.
Then just make sure that the registration runmode is not protected (so
that the CAP::Authen prerun hook will not be executed, and any user
can try to register a new acount.

sub register {
 my $self = shift;

 # Do your normal registration stuff

 $self->authen->initialize;

 # redirect to your start page (using an external redirect)
}

I haven't tried that myself, but it should work.  If you look in the
source for CAP::Authen, look for the 'prerun_callback' subroutine to
see what other things the prerun code does.  You might also want to
set the last access time, or mark the this as a new login.

Cheers,

Cees

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to