[system] / trunk / webwork-modperl / lib / WeBWorK / ContentGenerator / Login.pm Repository:
ViewVC logotype

View of /trunk/webwork-modperl/lib/WeBWorK/ContentGenerator/Login.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 825 - (download) (as text) (annotate)
Mon May 12 23:49:50 2003 UTC (10 years ago) by malsyned
File size: 1991 byte(s)
Fixed BUG #16:
"Logging out from a practice user and logging back in doesn't work
right"
http://webwork3/bugzilla/show_bug.cgi?id=16
--Dennis

    1 ################################################################################
    2 # WeBWorK mod_perl (c) 2000-2002 WeBWorK Project
    3 # $Id$
    4 ################################################################################
    5 
    6 package WeBWorK::ContentGenerator::Login;
    7 use base qw(WeBWorK::ContentGenerator);
    8 
    9 =head1 NAME
   10 
   11 WeBWorK::ContentGenerator::Login - display a login form.
   12 
   13 =cut
   14 
   15 use strict;
   16 use warnings;
   17 use CGI qw();
   18 
   19 sub title {
   20   return "Login";
   21 }
   22 
   23 sub links {
   24   return "";
   25 }
   26 
   27 sub body {
   28   my $self = shift;
   29   my $r = $self->{r};
   30   my $course_env = $self->{ce};
   31   # get some stuff together
   32   my $user = $r->param("user") || "";
   33   my $key = $r->param("key");
   34   my $passwd = $r->param("passwd") || "";
   35   my $course = $course_env->{"courseName"};
   36 
   37   # WeBWorK::Authen::verify will set the note "authen_error"
   38   # if invalid authentication is found.  If this is done, it's a signal to
   39   # us to yell at the user for doing that, since Authen isn't a content-
   40   # generating module.
   41   if ($r->notes("authen_error")) {
   42     print CGI::font({-color => 'red'}, CGI::b($r->notes("authen_error"))),CGI::br();
   43   }
   44 
   45   print CGI::p("Please enter your username and password for ",CGI::b($course)," below:");
   46   print CGI::startform({-method=>"POST", -action=>$r->uri});
   47 
   48   # write out the form data posted to the requested URI
   49   print $self->print_form_data('<input type="hidden" name="','" value="',"\"/>\n",qr/^(user|passwd|key|force_passwd_authen)$/);
   50 
   51   print
   52     CGI::table({-border => 0},
   53       CGI::Tr([
   54         CGI::td([
   55           "Username:",
   56           CGI::input({-type=>"textfield", -name=>"user", -value=>"$user"}),CGI::br(),
   57         ]),
   58         CGI::td([
   59           "Password:",
   60           CGI::input({-type=>"password", -name=>"passwd", -value=>"$passwd"}) . CGI::i("(Will not be echoed)"),
   61         ]),
   62      ])
   63     )
   64   ;
   65 
   66   print CGI::input({-type=>"submit", -value=>"Continue"});
   67   print CGI::endform();
   68 
   69   return "";
   70 }
   71 
   72 # This content generator is NOT logged in.
   73 sub if_loggedin($$) {
   74   my ($self, $arg) = (@_);
   75 
   76   return !$arg;
   77 }
   78 
   79 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9