[LON-CAPA-cvs] cvs: loncom /auth lonauth.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Mon, 01 Oct 2007 23:56:14 -0000
albertel Mon Oct 1 19:56:14 2007 EDT
Modified files:
/loncom/auth lonauth.pm
Log:
- use the lonnet session validation mechanism
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.88 loncom/auth/lonauth.pm:1.89
--- loncom/auth/lonauth.pm:1.88 Wed Jul 25 18:35:47 2007
+++ loncom/auth/lonauth.pm Mon Oct 1 19:56:14 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network
# User Authentication Module
#
-# $Id: lonauth.pm,v 1.88 2007/07/25 22:35:47 albertel Exp $
+# $Id: lonauth.pm,v 1.89 2007/10/01 23:56:14 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -32,7 +32,6 @@
use LONCAPA;
use Apache::Constants qw(:common);
use CGI qw(:standard);
-use CGI::Cookie();
use DynaLoader; # for Crypt::DES version
use Crypt::DES;
use Apache::loncommon();
@@ -170,21 +169,16 @@
&Apache::lonlocal::get_language_handle($r);
# -------------------------------- Prevent users from attempting to login twice
- my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
- my $lonid=$cookies{'lonID'};
- my $cookie;
- if ($lonid) {
- my $handle=&LONCAPA::clean_handle($lonid->value);
- my $lonidsdir=$r->dir_config('lonIDsDir');
- if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {
+ my $handle = &Apache::lonnet::check_for_valid_session($r);
+ if ($handle ne '') {
# Indeed, a valid token is found
- &Apache::loncommon::content_type($r,'text/html');
- $r->send_http_header;
- my $start_page =
- &Apache::loncommon::start_page('Already logged in');
- my $end_page =
- &Apache::loncommon::end_page();
- $r->print(<<ENDFAILED);
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+ my $start_page =
+ &Apache::loncommon::start_page('Already logged in');
+ my $end_page =
+ &Apache::loncommon::end_page();
+ $r->print(<<ENDFAILED);
$start_page
<h1>You are already logged in</h1>
<p>Please either <a href="/adm/roles">continue the current session</a> or
@@ -193,8 +187,7 @@
<a href="/adm/loginproblems.html">Problems?</a></p>
$end_page
ENDFAILED
- return OK;
- }
+ return OK;
}
# ---------------------------------------------------- No valid token, continue