Diff for /loncom/auth/switchserver.pm between versions 1.17 and 1.21

version 1.17, 2007/09/29 04:03:46 version 1.21, 2007/11/15 01:17:16
Line 42  sub init_env { Line 42  sub init_env {
  return  $env{'user.environment'};   return  $env{'user.environment'};
     }      }
     my $requrl=$r->uri;      my $requrl=$r->uri;
     my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));      my $handle= &Apache::lonnet::check_for_valid_session($r);
     my $lonid=$cookies{'lonID'};      if ($handle ne '') {
     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);   
  return undef;   return undef;
     }      }
       my $lonidsdir=$r->dir_config('lonIDsDir');
     &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);      &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
           
     return $r->dir_config('lonIDsDir')."/$handle.id";      return $r->dir_config('lonIDsDir')."/$handle.id";
Line 99  sub handler { Line 92  sub handler {
   
     if ($env{'user.name'} eq 'public'      if ($env{'user.name'} eq 'public'
  && $env{'user.domain'} eq 'public') {   && $env{'user.domain'} eq 'public') {
  my $url = 'http://'.$switch_to.'/'.$r->uri;   my $url = 'http://'.$switch_to.$r->uri;
  return &do_redirect($r,$url,1)   return &do_redirect($r,$url,1)
     }      }
   
Line 122  sub handler { Line 115  sub handler {
     -value   => '',      -value   => '',
     -expires => '-10y',);      -expires => '-10y',);
     $r->header_out('Set-cookie' => $c);      $r->header_out('Set-cookie' => $c);
     $r->send_http_header;  
     return OK if $r->header_only;      if ($r->header_only) {
    $r->send_http_header;
    return OK;
       }
 # -------------------------------------------------------- Menu script and info  # -------------------------------------------------------- Menu script and info
         
     my $windowinfo=      my $windowinfo=
Line 145  sub handler { Line 141  sub handler {
     my $token = &Apache::lonnet::tmpput(\%info,$env{'form.otherserver'});      my $token = &Apache::lonnet::tmpput(\%info,$env{'form.otherserver'});
     my $url ='http://'.$switch_to.'/adm/login?'.      my $url ='http://'.$switch_to.'/adm/login?'.
  'domain='.$env{'user.domain'}.   'domain='.$env{'user.domain'}.
  '&username='.$env{'user.name'}.   '&username='.$env{'user.name'}.
  '&token='.$token;   '&token='.$token;
 # --------------------------------------------------------------- Screen Output  # --------------------------------------------------------------- Screen Output
     &Apache::lonnet::flushcourselogs();      &Apache::lonnet::flushcourselogs();
     return &do_redirect($r,$url,0,$windowinfo);      return &do_redirect($r,$url,0,$windowinfo);

Removed from v.1.17  
changed lines
  Added in v.1.21


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>