Skip to content
Snippets Groups Projects
Commit 833dcac7 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Added JSON error response; removed beta version logo

parent 401641ea
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,7 @@ clients: ...@@ -64,7 +64,7 @@ clients:
id: aao-dev id: aao-dev
secret: 2a97516c354b68848cdbd8f54a226a0a55b21ed138e207ad6c5cbb9c00aa5aea secret: 2a97516c354b68848cdbd8f54a226a0a55b21ed138e207ad6c5cbb9c00aa5aea
redirect: http://localhost:8081/aao/login 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 home: http://localhost:8081/aao
icon: asiago.gif icon: asiago.gif
showInHome: true showInHome: true
......
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
<div class="page-title-wrapper"> <div class="page-title-wrapper">
<h1 class="text-center"> <h1 class="text-center">
<a href="<?php echo $contextRoot; ?>/">Remote Authentication Portal</a> <a href="<?php echo $contextRoot; ?>/">Remote Authentication Portal</a>
<span class="circle-wrapper">
<div class="circle">beta<br/>version!</div>
</span>
</h1> </h1>
</div> </div>
</header> </header>
......
...@@ -52,12 +52,23 @@ Flight::map('error', function($ex) { ...@@ -52,12 +52,23 @@ Flight::map('error', function($ex) {
} }
} }
$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; global $locator;
Flight::render('error.php', array('title' => 'Error', Flight::render('error.php', array('title' => 'Error',
'version' => $locator->getVersion(), 'error' => $message, 'version' => $locator->getVersion(), 'error' => $message,
'contactEmail' => isset($locator->config->contactEmail) ? $locator->config->contactEmail : null, 'contactEmail' => isset($locator->config->contactEmail) ? $locator->config->contactEmail : null,
'contactLabel' => isset($locator->config->contactLabel) ? $locator->config->contactLabel : null, 'contactLabel' => isset($locator->config->contactLabel) ? $locator->config->contactLabel : null,
'contextRoot' => $locator->config->contextRoot)); 'contextRoot' => $locator->config->contextRoot));
}
}); });
// Starting Flight framework // Starting Flight framework
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment