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

Re: [cgiapp] Authenticate after user creates an account


Ron, thanks for asking.
The Authentication documentation says it's ok to call it multiple times.
As it turns out, I think initialize() is called before my runmode gets called,
then my runmode calls initialize() again (twice).  So it's being called 3 times.

I looked at the source code and saw this:
sub initialize {
   my $self = shift;
   return 1 if $self->{initialized};
   # It would seem to make more sense to do this at the /end/ of the routine
   # but that causes an infinite loop.
   $self->{initialized} = 1;

So in my runmode when I call initialize(), it simply returns
That gave me an idea (which worked!).  In my runmode I now have:

       $self->authen->{initialized} = 0;  # force reinitialization,
hence writes to storage
       $self->authen->initialize;

This causes the Authentication module to essentially reinitialize.
I will ask Cees to consider adding a reinitialize() (or
reauthenticate() or ...) method
to the module, as I think it would be useful.
-- Mark

On 1/5/07, Ron Savage <suppressed> wrote:
On Thu, 4 Jan 2007 23:29:37 -0500, Mark Rajcok wrote:

Hi Mark

> $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 ... } }

You call $self->authen->initialize twice. Is that causing a problem?
--
Cheers
Ron Savage, suppressed on 5/01/2007
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company


---------------------------------------------------------------------
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.