[system] / trunk / webwork2 / lib / WeBWorK / Login.pm Repository:
ViewVC logotype

View of /trunk/webwork2/lib/WeBWorK/Login.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 323 - (download) (as text) (annotate)
Thu May 30 20:34:46 2002 UTC (17 years, 7 months ago) by malsyned
File size: 2275 byte(s)
-Fixed a few interfaces so that they make more sense (I hope)
-Added preliminary templating code to ContentGenerator
-Added a lot of logic to the dispatcher (WeBWorK.pm).  More to come, too.
-Moved lots of things over to CGI.pm, for my convenience while prototyping
-Added preliminary examples of ProblemSets, ProblemSet, and Problem.
 Problem.pm will some day go on to do what ProcessProblem8 does right now,
 so keep your eyes on that one.
--Dennis

    1 #TODO: The HTML code here has two failings:
    2 # - It is hard-coded into the script, which is against policy
    3 # - It is very ugly and hastily written
    4 
    5 # Other than that, this file is done for the forseeable future,
    6 # and should serve us nicely unless the interface to WeBWorK::Authen
    7 # changes.
    8 
    9 package WeBWorK::Login;
   10 
   11 use WeBWorK::ContentGenerator;
   12 use Apache::Constants qw(:common);
   13 use CGI qw(-comple :html :form);
   14 
   15 our @ISA = qw(WeBWorK::ContentGenerator);
   16 
   17 sub go($) {
   18   my $self = shift;
   19   my $r = $self->{r};
   20   my $course_env = $self->{courseEnvironment};
   21   # get some stuff together
   22   my $user = $r->param("user");
   23   my $key = $r->param("key");
   24   my $passwd = $r->param("passwd");
   25   my $course = $course_env->{"courseName"};
   26 
   27   $self->header; return OK if $r->header_only;
   28   $self->top("Login page");
   29 
   30   # WeBWorK::Authen::verify will set the note "authen_error"
   31   # if invalid authentication is found.  If this is done, it's a signal to
   32   # us to yell at the user for doing that, since Authen isn't a content-
   33   # generating module.
   34   if ($r->notes("authen_error")) {
   35       print '<font color="red"><b>',$r->notes("authen_error"),"</b></font><br>";
   36   }
   37 
   38   # $self->print_form_data(""," = ","<br>\n");
   39 
   40   print p("Please enter your username and password for ",
   41     b($course),
   42     " below:");
   43 
   44   print startform({-method=>"POST", -action=>$r->uri});
   45 
   46   #  '<form method="POST" action="',$r->uri,'">';
   47 
   48   # write out the form data posted to the requested URI
   49   $self->print_form_data('<input type="hidden" name="','" value="',"\"/>\n",qr/^(user|passwd|key)$/);
   50 
   51   print
   52     table({-border => 0},
   53       Tr([
   54         td([
   55           "Username:",
   56           input({-type=>"textfield", -name=>"user", -value=>"$user"}),br,
   57         ]),
   58         td([
   59           "Password:",
   60           input({-type=>"password", -name=>"passwd", -value=>"$passwd"}) . i("(Will not be echoed)"),
   61         ]),
   62      ])
   63     )
   64   ;
   65 
   66   print input({-type=>"submit", -value=>"Continue"});
   67 # print '<table border="0"><tr><td>Username:</td><td><input type="textfield" name="user" value="',$user,'"><br></td></tr>',
   68 #   '<tr><td>Password:</td><td><input type="password" name="passwd" value="',$passwd,'"><i>(Will not be echoed)</i></tr></table>',
   69 #   '<input type="submit" value="Continue">',
   70   print endform;
   71   print '</body></html>';
   72 
   73   return OK;
   74 }
   75 
   76 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9