mirror of
https://github.com/til-schneider/slim-wiki.git
synced 2025-07-31 13:50:24 +02:00
Fixed: Saving editor caused error if editing a page of a subdirectory while the password was only entered for that subdirectory (and not on root level)
This commit is contained in:
@@ -49,6 +49,9 @@ class Main {
|
||||
try {
|
||||
$responseData['result'] = call_user_func_array(array($object, $methodName), $requestData['params']);
|
||||
} catch (Exception $exc) {
|
||||
if ($exc->getMessage() == 'Not logged in') {
|
||||
$this->setUnauthorizedHeaders();
|
||||
}
|
||||
$msg = "Calling RPC $objectName.$methodName failed: " . $exc->getMessage();
|
||||
error_log($msg);
|
||||
$responseData['error'] = array( 'code' => -32000, 'message' => $msg );
|
||||
@@ -78,9 +81,7 @@ class Main {
|
||||
if ($mode == 'edit' && ! $config['demoMode']) {
|
||||
$loginState = $this->context->getEditorService()->getLoginState();
|
||||
if ($loginState != 'logged-in') {
|
||||
$wikiName = $this->context->getConfig()['wikiName'];
|
||||
header('WWW-Authenticate: Basic realm="'.$wikiName.'"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
$this->setUnauthorizedHeaders();
|
||||
|
||||
$mode = 'view';
|
||||
$showCreateUserButton = true;
|
||||
@@ -150,6 +151,12 @@ class Main {
|
||||
}
|
||||
}
|
||||
|
||||
private function setUnauthorizedHeaders() {
|
||||
$wikiName = $this->context->getConfig()['wikiName'];
|
||||
header('WWW-Authenticate: Basic realm="'.$wikiName.'"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
}
|
||||
|
||||
private function isUserDefined() {
|
||||
$config = $this->context->getConfig();
|
||||
foreach ($config as $key => $value) {
|
||||
|
Reference in New Issue
Block a user