aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-12-23 09:09:10 +0100
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-12-23 09:09:10 +0100
commit1810c13b55b01043620fd81a65ce6e84cccc429c (patch)
tree3eea228ad7e3d9272b0fd92c44544ad8d5eb23a1
parenta0aa150418b628b32b18c70436d6be495129ee38 (diff)
downloadwallabag-1810c13b55b01043620fd81a65ce6e84cccc429c.tar.gz
wallabag-1810c13b55b01043620fd81a65ce6e84cccc429c.tar.zst
wallabag-1810c13b55b01043620fd81a65ce6e84cccc429c.zip
PHP_AUTH_USER isn't available when using php as cgi
-rw-r--r--inc/poche/Poche.class.php22
-rw-r--r--index.php9
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 /**
diff --git a/index.php b/index.php
index 145da772..fb251298 100644
--- a/index.php
+++ b/index.php
@@ -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;