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

View of /trunk/webwork2/lib/WeBWorK/ContentGenerator/Logout.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 646 - (download) (as text) (annotate)
Sat Nov 23 00:25:40 2002 UTC (10 years, 6 months ago) by sh002i
File size: 1231 byte(s)
added REAL logout support. keys now get invalidated at logout.
also, fixed a bug in classlist (see the diff).
also, added a sub to Utils (see the diff).
-sam

    1 ################################################################################
    2 # WeBWorK mod_perl (c) 2000-2002 WeBWorK Project
    3 # $Id$
    4 ################################################################################
    5 
    6 package WeBWorK::ContentGenerator::Logout;
    7 
    8 =head1 NAME
    9 
   10 WeBWorK::ContentGenerator::Logout - invalidate key and display logout message.
   11 
   12 =cut
   13 
   14 use strict;
   15 use warnings;
   16 use base qw(WeBWorK::ContentGenerator);
   17 use Apache::Constants qw(:common);
   18 use CGI qw();
   19 use WeBWorK::ContentGenerator;
   20 
   21 sub title {
   22   return "Logout";
   23 }
   24 
   25 sub links {
   26   return "";
   27 }
   28 
   29 sub body {
   30   my $self = shift;
   31   my $r = $self->{r};
   32   my $ce = $self->{courseEnvironment};
   33 
   34   my $authdb = WeBWorK::DB::Auth->new($ce);
   35   my $root = $ce->{webworkURLs}->{root};
   36   my $courseName = $ce->{courseName};
   37   my $userName = $r->param("user");
   38 
   39   eval { $authdb->deleteKey($userName) };
   40   if ($@) {
   41     print CGI::p("Something went wrong while logging out of WeBWorK: $@");
   42   }
   43 
   44   print CGI::p("You have been logged out of WeBWorK.");
   45   print CGI::start_form(-method=>"POST", -action=>"$root/$courseName/");
   46   print CGI::hidden("user", $userName);
   47   print CGI::p({-align=>"center"}, CGI::submit("submit", "Log In Again"));
   48   print CGI::end_form();
   49 
   50   return "";
   51 }
   52 
   53 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9