diff --git a/config-example.yaml b/config-example.yaml index a850423765872916b1e03d384932a5bb7ed80626..dbb218ed805a3f1e91c2cc34e41c9250550bc580 100644 --- a/config-example.yaml +++ b/config-example.yaml @@ -64,7 +64,7 @@ clients: id: aao-dev secret: 2a97516c354b68848cdbd8f54a226a0a55b21ed138e207ad6c5cbb9c00aa5aea redirect: http://localhost:8081/aao/login - scope: "openid read:userspace write:userspace read:fileserver write:fileserver read:gms" + scope: "openid read:userspace write:userspace read:fileserver write:fileserver read:gms read:rap" home: http://localhost:8081/aao icon: asiago.gif showInHome: true diff --git a/include/header.php b/include/header.php index d65320243d12a38f60d249241dc074602a570897..d7ad4dce2ef658da1c02cb0f21215250ed8b4aa6 100644 --- a/include/header.php +++ b/include/header.php @@ -18,9 +18,6 @@ <div class="page-title-wrapper"> <h1 class="text-center"> <a href="<?php echo $contextRoot; ?>/">Remote Authentication Portal</a> - <span class="circle-wrapper"> - <div class="circle">beta<br/>version!</div> - </span> </h1> </div> </header> diff --git a/index.php b/index.php index 451735075de5c6d22d135181e422840fc085d790..aebafe4cafb085a3b9e1f033668c7956400c48cd 100644 --- a/index.php +++ b/index.php @@ -52,12 +52,23 @@ Flight::map('error', function($ex) { } } - global $locator; - Flight::render('error.php', array('title' => 'Error', - 'version' => $locator->getVersion(), 'error' => $message, - 'contactEmail' => isset($locator->config->contactEmail) ? $locator->config->contactEmail : null, - 'contactLabel' => isset($locator->config->contactLabel) ? $locator->config->contactLabel : null, - 'contextRoot' => $locator->config->contextRoot)); + $headers = apache_request_headers(); + $useJson = false; + if (array_key_exists('Accept', $headers)) { + $accept = $headers['Accept']; + $useJson = ($accept === 'application/json' || $accept === 'text/json'); + } + + if ($useJson) { + echo json_encode(["error" => $message]); + } else { + global $locator; + Flight::render('error.php', array('title' => 'Error', + 'version' => $locator->getVersion(), 'error' => $message, + 'contactEmail' => isset($locator->config->contactEmail) ? $locator->config->contactEmail : null, + 'contactLabel' => isset($locator->config->contactLabel) ? $locator->config->contactLabel : null, + 'contextRoot' => $locator->config->contextRoot)); + } }); // Starting Flight framework