Diff for /loncom/auth/lonauth.pm between versions 1.155 and 1.156

version 1.155, 2018/11/10 10:53:01 version 1.156, 2018/12/26 20:10:21
Line 304  sub failed { Line 304  sub failed {
             $retry .= (($retry=~/\?/)?'&':'?').'firsturl='.$firsturl;              $retry .= (($retry=~/\?/)?'&':'?').'firsturl='.$firsturl;
         }          }
     }      }
       if (exists($form->{linkprot})) {
           my $ltoken = &Apache::lonnet::tmpput({linkprot => $form->{'linkprot'}},
                                                $r->dir_config('lonHostID'));
           if ($ltoken) {
               $retry .= (($retry =~ /\?/) ? '&' : '?').'ltoken='.$ltoken;
           }
       }
     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;
Line 438  sub handler { Line 445  sub handler {
         return OK;          return OK;
     }      }
   
     my ($key,$firsturl,$rolestr,$symbstr,$iptokenstr)=split(/&/,$tmpinfo);      my ($key,$firsturl,$rolestr,$symbstr,$iptokenstr,$linkprotstr)=split(/&/,$tmpinfo);
     if ($rolestr) {      if ($rolestr) {
         $rolestr = &unescape($rolestr);          $rolestr = &unescape($rolestr);
     }      }
Line 448  sub handler { Line 455  sub handler {
     if ($iptokenstr) {      if ($iptokenstr) {
         $iptokenstr = &unescape($iptokenstr);          $iptokenstr = &unescape($iptokenstr);
     }      }
       if ($linkprotstr) {
           $linkprotstr = &unescape($linkprotstr);
       }
     if ($firsturl =~ m{^/tiny/$match_domain/\w+$}) {      if ($firsturl =~ m{^/tiny/$match_domain/\w+$}) {
         $form{'firsturl'} = $firsturl;          $form{'firsturl'} = $firsturl;
     }      }
Line 460  sub handler { Line 470  sub handler {
     if ($iptokenstr =~ /^iptoken=/) {      if ($iptokenstr =~ /^iptoken=/) {
         (undef,$form{'iptoken'}) = split('=',$iptokenstr);          (undef,$form{'iptoken'}) = split('=',$iptokenstr);
     }      }
       if ($linkprotstr =~ /^linkprot=/) {
           (undef,$form{'linkprot'}) = split('=',$linkprotstr);
       }
   
     my $upass = $ENV{HTTPS} ? $form{'upass0'}      my $upass = $ENV{HTTPS} ? $form{'upass0'}
         : &Apache::loncommon::des_decrypt($key,$form{'upass0'});          : &Apache::loncommon::des_decrypt($key,$form{'upass0'});
Line 632  sub handler { Line 645  sub handler {
                      \%form);                       \%form);
             my $switchto = '/adm/switchserver?otherserver='.$otherserver;              my $switchto = '/adm/switchserver?otherserver='.$otherserver;
             if (($firsturl) && ($firsturl ne '/adm/switchserver') && ($firsturl ne '/adm/roles')) {              if (($firsturl) && ($firsturl ne '/adm/switchserver') && ($firsturl ne '/adm/roles')) {
                 $switchto .= '&origurl='.$firsturl;                  $switchto .= '&origurl='.$firsturl; #should escape
             }              }
             if ($form{'role'}) {              if ($form{'role'}) {
                 $switchto .= '&role='.$form{'role'};                  $switchto .= '&role='.$form{'role'};
Line 640  sub handler { Line 653  sub handler {
             if ($form{'symb'}) {              if ($form{'symb'}) {
                 $switchto .= '&symb='.$form{'symb'};                  $switchto .= '&symb='.$form{'symb'};
             }              }
               if ($form{'linkprot'}) {
                   $env{'request.linkprot'} = $form{'linkprot'};
               }
             $r->internal_redirect($switchto);              $r->internal_redirect($switchto);
         } else {          } else {
             $r->print(&noswitch());              $r->print(&noswitch());
Line 653  sub handler { Line 669  sub handler {
                          \%form);                           \%form);
                 my $switchto = '/adm/switchserver?otherserver='.$otherserver;                  my $switchto = '/adm/switchserver?otherserver='.$otherserver;
                 if (($firsturl) && ($firsturl ne '/adm/switchserver') && ($firsturl ne '/adm/roles')) {                  if (($firsturl) && ($firsturl ne '/adm/switchserver') && ($firsturl ne '/adm/roles')) {
                     $switchto .= '&origurl='.$firsturl;                      $switchto .= '&origurl='.$firsturl; #should escape
                 }                  }
                 if ($form{'role'}) {                  if ($form{'role'}) {
                     $switchto .= '&role='.$form{'role'};                      $switchto .= '&role='.$form{'role'};
Line 661  sub handler { Line 677  sub handler {
                 if ($form{'symb'}) {                  if ($form{'symb'}) {
                     $switchto .= '&symb='.$form{'symb'};                      $switchto .= '&symb='.$form{'symb'};
                 }                  }
                   if ($form{'linkprot'}) {
                       $env{'request.linkprot'} = $form{'linkprot'};
                   }
                 $r->internal_redirect($switchto);                  $r->internal_redirect($switchto);
             } else {              } else {
                 $r->print(&noswitch());                  $r->print(&noswitch());
Line 690  sub handler { Line 709  sub handler {
             if ($unloaded) {              if ($unloaded) {
                 &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',                  &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',
                          undef,\%form);                           undef,\%form);
                   if ($form{'linkprot'}) {
                       $env{'request.linkprot'} = $form{'linkprot'};
                   }
                 $r->internal_redirect('/adm/switchserver?otherserver='.$unloaded.'&origurl='.$firsturl);                  $r->internal_redirect('/adm/switchserver?otherserver='.$unloaded.'&origurl='.$firsturl);
                 return OK;                  return OK;
             }              }
Line 697  sub handler { Line 719  sub handler {
         if (($is_balancer) && ($hosthere)) {          if (($is_balancer) && ($hosthere)) {
             $form{'noloadbalance'} = $hosthere;              $form{'noloadbalance'} = $hosthere;
         }          }
         &success($r,$form{'uname'},$form{'udom'},$authhost,$firsturl,undef,          my $extra_env;
           if ($form{'linkprot'}) {
               my ($linkprotector,$uri) = split(/:/,$form{'linkprot'},2);
               if ($linkprotector) {
                   $extra_env = {'user.linkprotector' => $linkprotector,
                                 'user.linkproturi'   => $uri,};
               }
           }
           &success($r,$form{'uname'},$form{'udom'},$authhost,$firsturl,$extra_env,
                  \%form);                   \%form);
         return OK;          return OK;
     }      }
Line 744  sub check_can_host { Line 774  sub check_can_host {
                 my $protocol = $Apache::lonnet::protocol{$login_host};                  my $protocol = $Apache::lonnet::protocol{$login_host};
                 $protocol = 'http' if ($protocol ne 'https');                  $protocol = 'http' if ($protocol ne 'https');
                 my $newurl = $protocol.'://'.$hostname.'/adm/createaccount';                  my $newurl = $protocol.'://'.$hostname.'/adm/createaccount';
   #FIXME Should preserve where user was going and linkprot by setting ltoken at $login_host
                 $r->print(&Apache::loncommon::start_page('Create a user account in LON-CAPA').                  $r->print(&Apache::loncommon::start_page('Create a user account in LON-CAPA').
                           '<h3>'.&mt('Account creation').'</h3>'.                            '<h3>'.&mt('Account creation').'</h3>'.
                           &mt('You do not currently have a LON-CAPA account at this institution.').'<br />'.                            &mt('You do not currently have a LON-CAPA account at this institution.').'<br />'.
Line 760  sub check_can_host { Line 791  sub check_can_host {
         } else {          } else {
             &success($r,$form->{'uname'},$udom,$authhost,'noredirect',undef,              &success($r,$form->{'uname'},$udom,$authhost,'noredirect',undef,
                      $form);                       $form);
               if ($form->{'linkprot'}) {
                   $env{'request.linkprot'} = $form->{'linkprot'};
               }
             my ($otherserver) = &Apache::lonnet::choose_server($udom);              my ($otherserver) = &Apache::lonnet::choose_server($udom);
             $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver);              $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver);
         }          }

Removed from v.1.155  
changed lines
  Added in v.1.156


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