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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Wed, 14 Nov 2007 02:54:16 -0000


albertel		Tue Nov 13 21:54:16 2007 EDT

  Modified files:              
    /loncom/auth	switchserver.pm 
  Log:
  - use the check_for_valid session code
  
  
Index: loncom/auth/switchserver.pm
diff -u loncom/auth/switchserver.pm:1.17 loncom/auth/switchserver.pm:1.18
--- loncom/auth/switchserver.pm:1.17	Sat Sep 29 00:03:46 2007
+++ loncom/auth/switchserver.pm	Tue Nov 13 21:54:11 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Switch Servers Handler
 #
-# $Id: switchserver.pm,v 1.17 2007/09/29 04:03:46 albertel Exp $
+# $Id: switchserver.pm,v 1.18 2007/11/14 02:54:11 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -42,18 +42,11 @@
 	return  $env{'user.environment'};
     }
     my $requrl=$r->uri;
-    my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
-    my $lonid=$cookies{'lonID'};
-    my $cookie;
-    if (!$lonid) { return undef; }
-
-    my $handle=&LONCAPA::clean_handle($lonid->value);
-    my $lonidsdir=$r->dir_config('lonIDsDir');
-    if ((!-e "$lonidsdir/$handle.id") || ($handle eq '')) {
-	$r->log_reason("Cookie $handle not valid", $r->filename); 
+    my $handle= &Apache::lonnet::check_for_valid_session($r);
+    if ($handle ne '') {
 	return undef;
     }
-
+    my $lonidsdir=$r->dir_config('lonIDsDir');
     &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
     
     return $r->dir_config('lonIDsDir')."/$handle.id";