Ticket #1485076: http_auth_svn.diff

File http_auth_svn.diff, 1.3 kB (added by ryanroth, 7 months ago)

Fixed for SVN and small refresh issue

  • index.php

     
    144144  } 
    145145} 
    146146 
     147// not logged in -> try to log in using the HTTP authentication credentials if available and configured to do so 
     148// mostly copied from the normal login procedure (=> refactor) 
     149if ($CONFIG['reuse_http_auth'] && empty($USER->ID) && isset($_SERVER['PHP_AUTH_USER'])) { 
     150  $host = $RCMAIL->autoselect_host(); 
    147151 
     152// check if client supports cookies 
     153  if (empty($_COOKIE)) 
     154    { 
     155      $OUTPUT->show_message("cookiesdisabled", 'warning'); 
     156    } 
     157  else if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW']) && 
     158           $RCMAIL->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $host)) 
     159  { 
     160// create new session ID 
     161  unset($_SESSION['temp']); 
     162  sess_regenerate_id(); 
     163 
     164// send auth cookie if necessary 
     165  $RCMAIL->authenticate_session(); 
     166 
     167// send redirect 
     168    header( 'refresh: 1'); 
     169 
     170  exit; 
     171  } 
     172else 
     173  { 
     174  $OUTPUT->show_message($IMAP->error_code == -1 ? 'imaperror' : 'loginfailed', 'warning'); 
     175  $RCMAIL->kill_session(); 
     176  } 
     177} 
     178 
    148179// not logged in -> show login page 
    149180if (empty($RCMAIL->user->ID)) { 
    150181  // check if installer is still active