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

raeburn raeburn@source.lon-capa.org
Wed, 17 Mar 2010 17:51:06 -0000


raeburn		Wed Mar 17 17:51:06 2010 EDT

  Modified files:              
    /loncom/auth	lonauth.pm 
  Log:
  - If user is already logged in, load user's %env so primary_menu links are shown for user.
  - Don't display "login problems" link, if user is already logged in,
    as it doesn't make sense here.
  
  
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.102 loncom/auth/lonauth.pm:1.103
--- loncom/auth/lonauth.pm:1.102	Wed Mar 10 21:25:29 2010
+++ loncom/auth/lonauth.pm	Wed Mar 17 17:51:06 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # User Authentication Module
 #
-# $Id: lonauth.pm,v 1.102 2010/03/10 21:25:29 droeschl Exp $
+# $Id: lonauth.pm,v 1.103 2010/03/17 17:51:06 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -200,23 +200,29 @@
 # -------------------------------- 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].'
+            &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();
+            $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;
+              .'</p>'
+              .$end_page
+            );
+            return OK;
+        }
     }
 
 # ---------------------------------------------------- No valid token, continue