Diff for /loncom/auth/lonauth.pm between versions 1.121.2.4 and 1.121.2.7

version 1.121.2.4, 2013/08/13 13:29:09 version 1.121.2.7, 2013/12/20 15:03:55
Line 171  ENDSUCCESS Line 171  ENDSUCCESS
   
 sub failed {  sub failed {
     my ($r,$message,$form) = @_;      my ($r,$message,$form) = @_;
     my $start_page = &Apache::loncommon::start_page('Unsuccessful Login',undef);      (undef,undef,undef,my $clientmathml,my $clientunicode) =
     my $retry = '/adm/login?username='.$form->{'uname'}.          &Apache::loncommon::decode_user_agent();
                 '&domain='.$form->{'udom'};      my $args = {};
       if ($clientunicode && !$clientmathml) {
           $args = {'browser.unicode' => 1};
       }
   
       my $start_page = &Apache::loncommon::start_page('Unsuccessful Login',undef,$args);
       my $uname = &Apache::loncommon::cleanup_html($form->{'uname'});
       my $udom = &Apache::loncommon::cleanup_html($form->{'udom'});
       if (&Apache::lonnet::domain($udom,'description') eq '') {
           undef($udom);
       }
       my $retry = '/adm/login';
       if ($uname eq $form->{'uname'}) {
           $retry .= '?username='.$uname;
       }
       if ($udom) {
           $retry .= (($retry=~/\?/)?'&':'?').'domain='.$udom;
       }
     if (exists($form->{role})) {      if (exists($form->{role})) {
         $retry .= '&role='.$form->{role};          my $role = &Apache::loncommon::cleanup_html($form->{role});
           if ($role ne '') {
               $retry .= (($retry=~/\?/)?'&':'?').'role='.$role;
           }
     }      }
     if (exists($form->{symb})) {      if (exists($form->{symb})) {
         $retry .= '&symb='.$form->{symb};          my $symb = &Apache::loncommon::cleanup_html($form->{symb});
           if ($symb ne '') {
               $retry .= (($retry=~/\?/)?'&':'?').'symb='.$symb;
           }
     }      }
     my $end_page   = &Apache::loncommon::end_page();      my $end_page = &Apache::loncommon::end_page();
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
     my $loginhelp = &loginhelpdisplay($form->{'udom'});      my $loginhelp = &loginhelpdisplay($udom);
     if ($loginhelp) {      if ($loginhelp) {
         $loginhelp = '<p><a href="'.$loginhelp.'">'.&mt('Login problems?').'</a></p>';          $loginhelp = '<p><a href="'.$loginhelp.'">'.&mt('Login problems?').'</a></p>';
     }      }
Line 205  sub reroute { Line 228  sub reroute {
     my ($r) = @_;      my ($r) = @_;
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
     my $msg='<h1>'.&mt('Sorry ...').'</h1>'      my $msg='<b>'.&mt('Sorry ...').'</b><br />'
            .&mt('Please [_1]log in again[_2].');             .&mt('Please [_1]log in again[_2].');
     &Apache::loncommon::simple_error_page($r,'Rerouting',$msg);      &Apache::loncommon::simple_error_page($r,'Rerouting',$msg,{'no_auto_mt_msg' => 1});
 }  }
   
 # ---------------------------------------------------------------- Main handler  # ---------------------------------------------------------------- Main handler
Line 269  sub handler { Line 292  sub handler {
        $value =~ tr/+/ /;         $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;         $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
        $form{$name}=$value;         $form{$name}=$value;
     }       }
   
     if ((!$form{'uname'}) || (!$form{'upass0'}) || (!$form{'udom'})) {      if ((!$form{'uname'}) || (!$form{'upass0'}) || (!$form{'udom'})) {
  &failed($r,'Username, password and domain need to be specified.',   &failed($r,'Username, password and domain need to be specified.',
Line 294  sub handler { Line 317  sub handler {
     my $tmpinfo=Apache::lonnet::reply('tmpget:'.$form{'logtoken'},      my $tmpinfo=Apache::lonnet::reply('tmpget:'.$form{'logtoken'},
                                       $form{'serverid'});                                        $form{'serverid'});
   
       my %sessiondata;
       if ($form{'iptoken'}) {
           %sessiondata = &Apache::lonnet::tmpget($form{'iptoken'});
           my $delete = &Apache::lonnet::tmpdel($form{'token'});
       }
   
     if (($tmpinfo=~/^error/) || ($tmpinfo eq 'con_lost') ||       if (($tmpinfo=~/^error/) || ($tmpinfo eq 'con_lost') || 
         ($tmpinfo eq 'no_such_host')) {          ($tmpinfo eq 'no_such_host')) {
  &failed($r,'Information needed to verify your login information is missing, inaccessible or expired.',\%form);   &failed($r,'Information needed to verify your login information is missing, inaccessible or expired.',\%form);
Line 407  sub handler { Line 436  sub handler {
  ($firsturl=~/^\/adm\/(logout|remote)/)) {   ($firsturl=~/^\/adm\/(logout|remote)/)) {
  $firsturl='/adm/roles';   $firsturl='/adm/roles';
     }      }
   
       my $hosthere;
       if ($form{'iptoken'}) {
           if (($sessiondata{'domain'} eq $form{'udom'}) &&
               ($sessiondata{'username'} eq $form{'uname'})) {
               $hosthere = 1;
           }
       }
   
 # --------------------------------- Are we attempting to login as somebody else?  # --------------------------------- Are we attempting to login as somebody else?
     if ($form{'suname'}) {      if ($form{'suname'}) {
 # ------------ see if the original user has enough privileges to pull this stunt  # ------------ see if the original user has enough privileges to pull this stunt
Line 430  sub handler { Line 468  sub handler {
  }   }
     }      }
   
     my ($is_balancer,$otherserver) =       my ($is_balancer,$otherserver);
         &Apache::lonnet::check_loadbalancing($form{'uname'},$form{'udom'});  
       unless ($hosthere) {
           ($is_balancer,$otherserver) =
               &Apache::lonnet::check_loadbalancing($form{'uname'},$form{'udom'});
       }
   
     if ($is_balancer) {      if ($is_balancer) {
         if (!$otherserver) {           if (!$otherserver) { 

Removed from v.1.121.2.4  
changed lines
  Added in v.1.121.2.7


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