Hi,

I am missing something and am hoping you can help. I am using example code from CGI::Application::Plugin::Session. My code is at the end. My problem is that I display a login form, but when the user clicks ok, the cgiapp_prerun runs and because the login has not been processed yet, starts up a new session so I never get to another run mode (the login form template sets rm to student_pw). What is the trick I am missing?

cheers,

ski

sub cgiapp_init {
  my $self = shift;
  $self->session_config (
CGI_SESSION_OPTIONS => ["driver:File", $self->query, {Directory => '/tmp'}],
    DEFAULT_EXPIRY => '+5m',
    COOKIE_PARAMS => {-expires => '+5m', -path => '/tmp' },
    SEND_COOKIE => 1
  );
}

sub cgiapp_prerun {
  my $self=shift;
  unless ($self->session->param('logged-in') eq 'y') {
    $self->prerun_mode('login');
  }
}

sub setup {
  my $self = shift;
  $self->start_mode('login');
  $self->run_modes(
    'login' => 'showLoginForm',
    'student_pw' => 'showStudentPWForm'
  );
  $self->tmpl_path("/var/www/password/templates/");
}

# Show the first form for entering the esis id, staff acct, and staff password
# There is no session id created yet
sub showLoginForm{
  my $self = shift;
  my $q = $self->query;
  my $template = $self->load_tmpl('staff_form.tmpl');
  my $html = $template->output;
  return $html;
}

sub showStudentPWForm {
}

--
"When we try to pick out anything by itself, we find it
 connected to the entire universe"            John Muir

Chris "Ski" Kacoroski, [EMAIL PROTECTED], 425-681-0092

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