Diff for /loncom/auth/lonauth.pm between versions 1.149 and 1.154

version 1.149, 2018/03/23 01:01:29 version 1.154, 2018/07/04 16:58:19
Line 76  sub success { Line 76  sub success {
   
 # ----------------------------------------------------------- Get cookies ready  # ----------------------------------------------------------- Get cookies ready
     my ($securecookie,$defaultcookie);      my ($securecookie,$defaultcookie);
     if ($ENV{'SERVER_PORT'} == 443) {      my $ssl = $r->subprocess_env('https');
         $securecookie="lonID=$cookie; path=/; HttpOnly; secure";      if ($ssl) {
           $securecookie="lonSID=$cookie; path=/; HttpOnly; secure";
         my $lonidsdir=$r->dir_config('lonIDsDir');          my $lonidsdir=$r->dir_config('lonIDsDir');
         if (($lonidsdir) && (-e "$lonidsdir/$cookie.id")) {          if (($lonidsdir) && (-e "$lonidsdir/$cookie.id")) {
             my $linkname=substr(Digest::MD5::md5_hex(Digest::MD5::md5_hex(time(). {}. rand(). $$)), 0, 32).'_linked';              my $linkname=substr(Digest::MD5::md5_hex(Digest::MD5::md5_hex(time(). {}. rand(). $$)), 0, 32).'_linked';
Line 88  sub success { Line 89  sub success {
                                               "$lonidsdir/$linkname.id"); 1 };                                                "$lonidsdir/$linkname.id"); 1 };
             if ($made_symlink) {              if ($made_symlink) {
                 $defaultcookie = "lonLinkID=$linkname; path=/; HttpOnly;";                  $defaultcookie = "lonLinkID=$linkname; path=/; HttpOnly;";
                 &Apache::lonnet::appenv({'user.linkedenv' => "$lonidsdir/$linkname.id"});                  &Apache::lonnet::appenv({'user.linkedenv' => $linkname});
             }              }
         }          }
     } else {      } else {
Line 106  sub success { Line 107  sub success {
                 $r->headers_out->add('Set-cookie' => $defaultcookie);                  $r->headers_out->add('Set-cookie' => $defaultcookie);
             }              }
             $r->send_http_header;              $r->send_http_header;
               if (ref($form) eq 'HASH') {
                   $form->{'lti.reqcrs'} = $env{'request.lti.reqcrs'};
                   $form->{'lti.reqrole'} = $env{'request.lti.reqrole'};
                   $form->{'lti.sourcecrs'} = $env{'request.lti.sourcecrs'};
               }
             &Apache::ltiauth::lti_reqcrs($r,$domain,$form,$username,$domain);              &Apache::ltiauth::lti_reqcrs($r,$domain,$form,$username,$domain);
             return;              return;
         }          }
Line 160  sub success { Line 166  sub success {
         $destination .= 'source=login';          $destination .= 'source=login';
     }      }
   
     my $windowinfo = Apache::lonhtmlcommon::scripttag('self.name="loncapaclient";');      my $windowname = 'loncapaclient';
     my $header = '<meta HTTP-EQUIV="Refresh" CONTENT="0; url='.$destination.'" />';      if ($env{'request.lti.login'}) {
           $windowname .= 'lti';
       }
       my $windowinfo = Apache::lonhtmlcommon::scripttag('self.name="'.$windowname.'";');
     my $brcrum = [{'href' => '',      my $brcrum = [{'href' => '',
                    'text' => 'Successful Login'},];                     'text' => 'Successful Login'},];
     my $args = {'bread_crumbs' => $brcrum,};      my $args = {'bread_crumbs' => $brcrum,};
Line 198  sub success { Line 207  sub success {
     }      }
     $r->send_http_header;      $r->send_http_header;
   
     my $start_page=&Apache::loncommon::start_page('Successful Login',      my ($start_page,$js,$pagebody,$end_page);
                                                   $header,$args);      if ($env{'request.lti.login'}) {
     my $end_page  =&Apache::loncommon::end_page();          $args = {'only_body' => 1};
           if ($env{'request.lti.target'} eq '') {
     my $continuelink='<a href="'.$destination.'">'.&mt('Continue').'</a>';              my $ltitarget = (($destination =~ /\?/) ? '&' : '?').
                               'ltitarget=iframe';
     my %lt=&Apache::lonlocal::texthash(              $js = <<"ENDJS";
        'wel' => 'Welcome',  
        'pro' => 'Login problems?',  <script type="text/javascript">
        );  // <![CDATA[
     my $loginhelp = &loginhelpdisplay($domain);  function setLTItarget() {
     if ($loginhelp) {      var newloc = '$destination';
         $loginhelp = '<p><a href="'.$loginhelp.'">'.$lt{'pro'}.'</a></p>';      if (parent !== window) {
           newloc += '$ltitarget';
       }
       window.location.href=newloc;
   }
   // ]]>
   </script>
   
   ENDJS
               $args->{'add_entries'} = {'onload' => "javascript:setLTItarget();"};
               $pagebody =  '<noscript><span class="LC_warning">'
                           .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
                           .'</span></noscript>';
           } else {
               $args->{'redirect'} = [0,$destination,1];
           }
           $start_page=&Apache::loncommon::start_page('',$js,$args);
       } else {
           $args->{'redirect'} = [0,$destination];
           $start_page=&Apache::loncommon::start_page('Successful Login',
                                                      $js,$args);
   
           my %lt=&Apache::lonlocal::texthash(
              'wel' => 'Welcome',
              'pro' => 'Login problems?',
             );
           $pagebody = "<h1>$lt{'wel'}</h1>\n".
                       &mt('Welcome to the Learning[_1]Online[_2] Network with CAPA. Please wait while your session is being set up.','<i>','</i>');
           my $loginhelp = &loginhelpdisplay($domain);
           if ($loginhelp) {
               $pagebody .= '<p><a href="'.$loginhelp.'">'.$lt{'pro'}.'</a></p>';
           }
     }      }
       $end_page = &Apache::loncommon::end_page();
     my $welcome = &mt('Welcome to the Learning[_1]Online[_2] Network with CAPA. Please wait while your session is being set up.','<i>','</i>');  
     $r->print(<<ENDSUCCESS);      $r->print(<<ENDSUCCESS);
 $start_page  $start_page
 $windowinfo  $windowinfo
 <h1>$lt{'wel'}</h1>  $pagebody
 $welcome  
 $loginhelp  
 $continuelink  
 $end_page  $end_page
 ENDSUCCESS  ENDSUCCESS
     return;      return;

Removed from v.1.149  
changed lines
  Added in v.1.154


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