[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] Authenticate after user creates an account


I'm using CGI::Application::Plugin::Authentication and I'd like to
authenticate a new user when I create the DB record for the new user
(i.e., as part of the "create a new account" runmode):

sub maintain_user : Runmode {  # create or update a user account
...
   # -- if the user_id is zero, create a new user, otherwise update
existing user
   my $t = $self->load_tmpl('status.html');
   if ($q->param('user_id') == 0) {
   	# -- copy form fields to authentication fields (needed for
authen->initialize)
	    $q->param('authen_username',$q->param('username'));
	    $q->param('authen_password',$q->param('password'));
           $self->_create_user;  # puts stuff in DB
	    # -- authenticate/login user
	    $self->authen->initialize;
           return $t->output  . $self->authen->initialize . ' user='
. $self->authen->username
   } else {...  # update account ... }
}

$self->authen->initialize returns 1, but $self->authen->username is
uninitialized.
I tried loading the template after $self->authen->initialize, but that
didn't help.

If I attempt to go to another page/runmode that requires
authentication, the login screen appears (indicating the user was not
authenticated).
I can log into the new account.

Any help appreciated.
-- Mark

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


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.