--- loncom/auth/restrictedaccess.pm 2006/07/10 03:58:45 1.1 +++ loncom/auth/restrictedaccess.pm 2006/07/14 21:38:26 1.2 @@ -30,7 +30,6 @@ use strict; use lib '/home/httpd/lib/perl/'; use Apache::Constants qw(:common :http REDIRECT); use CGI::Cookie(); -use Apache::File (); use Apache::lonnet; use Apache::loncommon(); use Apache::lonauth(); @@ -42,28 +41,21 @@ use LONCAPA; sub handler { my $r = shift; - &Apache::loncommon::get_unprocessed_cgi - ($ENV{'QUERY_STRING'}.'&'.$env{'request.querystring'}, - ['origurl']); - - &Apache::lonacc::get_posted_cgi($r); my $origurl = &unescape($env{'form.origurl'}); - my $msg; + if (!defined($origurl)) { + $origurl = $r->uri; + } if (exists($env{'form.pass1'})) { my ($result,$end) = &check_pass($r,$origurl); if ($result eq 'ok') { - my $cookie_check = &print_redirect($r,$end,$origurl); - if ($cookie_check eq 'ok') { - $env{'request.state'} = "published"; - $env{'request.filename'} = $origurl; - $r->header_out(Location => 'http://'.$ENV{'HTTP_HOST'}.$origurl); - return REDIRECT; - } else { - &print_entryform($r,$origurl,$cookie_check); - } + &Apache::lonnet::appenv(('user.passphrase_access_'.$origurl => + $end)); + $env{'request.state'} = "published"; + $env{'request.filename'} = $origurl; + $r->header_out(Location => 'http://'.$ENV{'HTTP_HOST'}.$origurl); + return REDIRECT; } else { - $msg = "Invalid passphrase"; - &print_entryform($r,$origurl,$msg); + &print_entryform($r,$origurl,"Invalid passphrase"); } } else { &print_entryform($r,$origurl); @@ -85,14 +77,10 @@ function verify() { alert("You must enter a passphrase"); return; } - if (document.passform.pass1.value != document.passform.pass2.value) { - alert("Passphrases do not match"); - return; - } document.passform.submit(); } '); - $r->print(''.$msg.''); + $r->print(''.$msg.''); $r->print('