[LON-CAPA-cvs] cvs: loncom(version_2_10_X) /auth lonauth.pm

raeburn raeburn@source.lon-capa.org
Thu, 27 May 2010 22:05:47 -0000


raeburn		Thu May 27 22:05:47 2010 EDT

  Modified files:              (Branch: version_2_10_X)
    /loncom/auth	lonauth.pm 
  Log:
  - Backport 1.103.
  
  
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.101 loncom/auth/lonauth.pm:1.101.8.1
--- loncom/auth/lonauth.pm:1.101	Wed Jul 22 21:51:03 2009
+++ loncom/auth/lonauth.pm	Thu May 27 22:05:47 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # User Authentication Module
 #
-# $Id: lonauth.pm,v 1.101 2009/07/22 21:51:03 raeburn Exp $
+# $Id: lonauth.pm,v 1.101.8.1 2010/05/27 22:05:47 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -209,23 +209,33 @@
 # -------------------------------- Prevent users from attempting to login twice
     my $handle = &Apache::lonnet::check_for_valid_session($r);
     if ($handle ne '') {
+        my $lonidsdir=$r->dir_config('lonIDsDir');
+        if ($handle=~/^publicuser\_/) {
+# For "public user" - remove it, we apparently really want to login
+            unlink($r->dir_config('lonIDsDir')."/$handle.id");
+        } else {
 # 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(
-           $start_page
-          .'<h1>'.&mt('You are already logged in!').'</h1>'
-          .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].'
-                    ,'<a href="/adm/roles">','</a>','<a href="/adm/logout">','</a>')
-          .'</p>'
-          .'<p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'
-          .$end_page
-        );
-        return OK;
+            &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
+            &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();
+            my $dest = '/adm/roles';
+            if ($env{'form.firsturl'} ne '') {
+                $dest = $env{'form.firsturl'};
+            }
+            $r->print(
+               $start_page
+              .'<h1>'.&mt('You are already logged in!').'</h1>'
+              .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].'
+                    ,'<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>')
+              .'</p>'
+              .$end_page
+            );
+            return OK;
+        }
     }
 
 # ---------------------------------------------------- No valid token, continue