On 9/14/05 3:08 PM, "Ski Kacoroski" <[EMAIL PROTECTED]> wrote:
> 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?
I think that somewhere you have to process the input from the login form.
In other words, there has to be something (perhaps in the login run_mode)
that checks to see if a username and password were submitted from the login
form and then process these to see if the username and password are correct.
It is in this little piece of code that you have to set the "logged-in"
session variable.
> 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 {
> }
---------------------------------------------------------------------
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]