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

View of /trunk/webwork-modperl/lib/WeBWorK/ContentGenerator/Logout.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: 1283 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::Logout;
    7 use base qw(WeBWorK::ContentGenerator);
    8 
    9 =head1 NAME
   10 
   11 WeBWorK::ContentGenerator::Logout - invalidate key and display logout message.
   12 
   13 =cut
   14 
   15 use strict;
   16 use warnings;
   17 use CGI qw();
   18 
   19 sub title {
   20   return "Logout";
   21 }
   22 
   23 sub links {
   24   return "";
   25 }
   26 
   27 sub body {
   28   my $self = shift;
   29   my $r = $self->{r};
   30   my $ce = $self->{ce};
   31   my $db = $self->{db};
   32 
   33   my $root = $ce->{webworkURLs}->{root};
   34   my $courseName = $ce->{courseName};
   35   my $userName = $r->param("user");
   36 
   37   eval { $db->deleteKey($userName) };
   38   if ($@) {
   39     print CGI::p("Something went wrong while logging out of WeBWorK: $@");
   40   }
   41 
   42   print CGI::p("You have been logged out of WeBWorK.");
   43   print CGI::start_form(-method=>"POST", -action=>"$root/$courseName/");
   44   print CGI::hidden("user", $userName);
   45   print CGI::hidden("force_passwd_authen", 1);
   46   print CGI::p({-align=>"center"}, CGI::submit("submit", "Log In Again"));
   47   print CGI::end_form();
   48 
   49   return "";
   50 }
   51 
   52 # This content generator is NOT logged in.
   53 sub if_loggedin($$) {
   54   my ($self, $arg) = (@_);
   55 
   56   return !$arg;
   57 }
   58 
   59 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9