[LON-CAPA-cvs] cvs: loncom /auth checkauthen.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 19 Sep 2006 15:18:54 -0000


albertel		Tue Sep 19 11:18:54 2006 EDT

  Modified files:              
    /loncom/auth	checkauthen.pm 
  Log:
  - the $r->intenal_Redirects shortcutting of the login means we might have a loaded env, but no valid cookie, so check both places
  
  
Index: loncom/auth/checkauthen.pm
diff -u loncom/auth/checkauthen.pm:1.7 loncom/auth/checkauthen.pm:1.8
--- loncom/auth/checkauthen.pm:1.7	Thu Sep  7 13:07:26 2006
+++ loncom/auth/checkauthen.pm	Tue Sep 19 11:18:54 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # checks for a cokkie to authenticate a user
 #
-# $Id: checkauthen.pm,v 1.7 2006/09/07 17:07:26 albertel Exp $
+# $Id: checkauthen.pm,v 1.8 2006/09/19 15:18:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,15 +59,19 @@
 
     my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
     my $lonid=$cookies{'lonID'};
-    my $cookie;
+    my $handle;
     if ($lonid) {
-	my $handle=$lonid->value;
+        my $handle = $lonid->value;
         $handle=~s/\W//g;
-        my $lonidsdir=$r->dir_config('lonIDsDir');
-        if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {    
-	    return OK;
-	}
+        $handle = $r->dir_config('lonIDsDir')."/$handle.id";
+    } else {
+        $handle = $env{'user.environment'};
     }
+
+    if (($handle ne '') && (-e $handle)) {
+        return OK;
+    }
+
     return $fail;
 }