1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-11-23 17:42:15 -05:00

PHP_AUTH_USER isn't available when using php as cgi

This commit is contained in:
Nicolas Lœuillet 2013-12-23 09:09:10 +01:00
parent a0aa150418
commit 1810c13b55
2 changed files with 22 additions and 9 deletions

View File

@ -446,7 +446,7 @@ class Poche
$themes = $this->getInstalledThemes(); $themes = $this->getInstalledThemes();
$languages = $this->getInstalledLanguages(); $languages = $this->getInstalledLanguages();
$token = $this->user->getConfigValue('token'); $token = $this->user->getConfigValue('token');
$http_auth = (isset($_SERVER['PHP_AUTH_USER']))?true:false; $http_auth = (isset($_SERVER['PHP_AUTH_USER']) || isset($_SERVER['REMOTE_USER'])) ? true : false;
$tpl_vars = array( $tpl_vars = array(
'themes' => $themes, 'themes' => $themes,
'languages' => $languages, 'languages' => $languages,
@ -656,6 +656,10 @@ class Poche
if(!empty($_POST['login']) && !empty($_POST['password'])) { if(!empty($_POST['login']) && !empty($_POST['password'])) {
return array($_POST['login'],$_POST['password']); return array($_POST['login'],$_POST['password']);
} }
if(isset($_SERVER['REMOTE_USER'])) {
return array($_SERVER['REMOTE_USER'],'http_auth');
}
return array(false,false); return array(false,false);
} }

View File

@ -100,6 +100,15 @@ if (Session::isLogged()) {
$tpl_file = Tools::getTplFile('login'); $tpl_file = Tools::getTplFile('login');
$tpl_vars['http_auth'] = 1; $tpl_vars['http_auth'] = 1;
} }
} elseif(isset($_SERVER['REMOTE_USER'])) {
if($poche->store->userExists($_SERVER['REMOTE_USER'])) {
$poche->login($referer);
} else {
$poche->messages->add('e', _('login failed: user doesn\'t exist'));
Tools::logm('user doesn\'t exist');
$tpl_file = Tools::getTplFile('login');
$tpl_vars['http_auth'] = 1;
}
} else { } else {
$tpl_file = Tools::getTplFile('login'); $tpl_file = Tools::getTplFile('login');
$tpl_vars['http_auth'] = 0; $tpl_vars['http_auth'] = 0;