diff options
-rw-r--r-- | inc/poche/Poche.class.php | 22 | ||||
-rw-r--r-- | index.php | 9 |
2 files changed, 22 insertions, 9 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index adec9b28..4b26574d 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -446,7 +446,7 @@ class Poche | |||
446 | $themes = $this->getInstalledThemes(); | 446 | $themes = $this->getInstalledThemes(); |
447 | $languages = $this->getInstalledLanguages(); | 447 | $languages = $this->getInstalledLanguages(); |
448 | $token = $this->user->getConfigValue('token'); | 448 | $token = $this->user->getConfigValue('token'); |
449 | $http_auth = (isset($_SERVER['PHP_AUTH_USER']))?true:false; | 449 | $http_auth = (isset($_SERVER['PHP_AUTH_USER']) || isset($_SERVER['REMOTE_USER'])) ? true : false; |
450 | $tpl_vars = array( | 450 | $tpl_vars = array( |
451 | 'themes' => $themes, | 451 | 'themes' => $themes, |
452 | 'languages' => $languages, | 452 | 'languages' => $languages, |
@@ -649,14 +649,18 @@ class Poche | |||
649 | * it redirects the user to the $referer link | 649 | * it redirects the user to the $referer link |
650 | * @return array | 650 | * @return array |
651 | */ | 651 | */ |
652 | private function credentials() { | 652 | private function credentials() { |
653 | if(isset($_SERVER['PHP_AUTH_USER'])) { | 653 | if(isset($_SERVER['PHP_AUTH_USER'])) { |
654 | return array($_SERVER['PHP_AUTH_USER'],'php_auth'); | 654 | return array($_SERVER['PHP_AUTH_USER'],'php_auth'); |
655 | } | 655 | } |
656 | if(!empty($_POST['login']) && !empty($_POST['password'])) { | 656 | if(!empty($_POST['login']) && !empty($_POST['password'])) { |
657 | return array($_POST['login'],$_POST['password']); | 657 | return array($_POST['login'],$_POST['password']); |
658 | } | 658 | } |
659 | return array(false,false); | 659 | if(isset($_SERVER['REMOTE_USER'])) { |
660 | return array($_SERVER['REMOTE_USER'],'http_auth'); | ||
661 | } | ||
662 | |||
663 | return array(false,false); | ||
660 | } | 664 | } |
661 | 665 | ||
662 | /** | 666 | /** |
@@ -100,6 +100,15 @@ if (Session::isLogged()) { | |||
100 | $tpl_file = Tools::getTplFile('login'); | 100 | $tpl_file = Tools::getTplFile('login'); |
101 | $tpl_vars['http_auth'] = 1; | 101 | $tpl_vars['http_auth'] = 1; |
102 | } | 102 | } |
103 | } elseif(isset($_SERVER['REMOTE_USER'])) { | ||
104 | if($poche->store->userExists($_SERVER['REMOTE_USER'])) { | ||
105 | $poche->login($referer); | ||
106 | } else { | ||
107 | $poche->messages->add('e', _('login failed: user doesn\'t exist')); | ||
108 | Tools::logm('user doesn\'t exist'); | ||
109 | $tpl_file = Tools::getTplFile('login'); | ||
110 | $tpl_vars['http_auth'] = 1; | ||
111 | } | ||
103 | } else { | 112 | } else { |
104 | $tpl_file = Tools::getTplFile('login'); | 113 | $tpl_file = Tools::getTplFile('login'); |
105 | $tpl_vars['http_auth'] = 0; | 114 | $tpl_vars['http_auth'] = 0; |