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

www lon-capa-cvs@mail.lon-capa.org
Wed, 23 Nov 2005 20:58:32 -0000


www		Wed Nov 23 15:58:32 2005 EDT

  Modified files:              
    /loncom/auth	lonlogin.pm 
  Log:
  More sticky than I thought.
  
  
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.69 loncom/auth/lonlogin.pm:1.70
--- loncom/auth/lonlogin.pm:1.69	Wed Nov 23 15:46:04 2005
+++ loncom/auth/lonlogin.pm	Wed Nov 23 15:58:31 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Login Screen
 #
-# $Id: lonlogin.pm,v 1.69 2005/11/23 20:46:04 www Exp $
+# $Id: lonlogin.pm,v 1.70 2005/11/23 20:58:31 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -60,10 +60,15 @@
 	my $handle=$lonid->value;
         $handle=~s/\W//g;
         my $lonidsdir=$r->dir_config('lonIDsDir');
-        if ((-e "$lonidsdir/$handle.id") && ($handle ne '') && ($handle!~/^publicuser\_/)) {
+	if (-e "$lonidsdir/$handle.id") {
+# Is there an existing token file?
+	    if ($handle=~/^publicuser\_/) {
+# For "public user" - remove it, we apparently really want to login
+		unlink("$lonidsdir/$handle.id");
+	    } elsif ($handle ne '') {
 # Indeed, a valid token is found
-	    my $bodytag=&Apache::loncommon::bodytag('Already logged in');
-	    $r->print(<<ENDFAILED);
+		my $bodytag=&Apache::loncommon::bodytag('Already logged in');
+		$r->print(<<ENDFAILED);
 <html>
 <head>
 <title>Already logged in</title>
@@ -77,7 +82,8 @@
 </body>
 </html>
 ENDFAILED
-           return OK;
+                return OK;
+ 	    }  
 	}
     }
 
@@ -86,8 +92,12 @@
     &Apache::loncommon::get_unprocessed_cgi
      ($ENV{'QUERY_STRING'}.'&'.$env{'request.querystring'},
       ['interface','username','domain','firsturl','localpath','localres']);
- 
 
+ # ---------------------------- Not possible to really login to domain "public"
+    if ($env{'form.domain'} eq 'public') {
+	$env{'form.domain'}='';
+	$env{'form.username'}='';
+    }
 # ----------------------------------------------------------- Process Interface
     $env{'form.interface'}=~s/\W//g;