[cgiapp] :Authentication: log in a user by script

Alex capfan at gmx.de
Tue Oct 20 16:39:35 EDT 2009


Dear all!

I created a multi step registration form. It collects some data from a user,
including a email address, asks for a confirmation code and finally set up
some things.

After the last step, when all data is written to the database while creating
a new user, I want to log in this user, set up a message to hail him welcome
and redirect him to his workspace.

There is a tutorial on http://cgiapp.erlbaum.net that shows a similar
approach, although they use their own authentication procedure. I want to
stick with CGI::Application::Plugin::Authentication, because the system is
already implemented using the module. I just reworked the registration part.

So, is there any possibility to easily authenticate a user in the script?
There is no such method like $cgiapp->authen->authenticate_user($username,
$password);
If I got it right, during prerun stage, the query object is queried for
authentication credentials. This process is a singleton, so I cannot simply
add the username and the password in a runmode and call the initialize
method of authen() again (nor would I want that for some reasons).

I was thinking on encapsulating the part of initialize(), that actually
authenticates a user, so it could be used by initialize() and a new method
authenticate_user(). But I'm not sure if this would be a good thing, so I
ask you to judge (the approach).

Regards, Alex




More information about the cgiapp mailing list