Fix error logic if no API key passed to provisioning/create API

This commit is contained in:
Albert Santoni 2015-07-31 11:43:58 -04:00
parent bda6a4585c
commit 84c21de578
1 changed files with 6 additions and 2 deletions

View File

@ -24,8 +24,12 @@ class ProvisioningHelper
*/
public function createAction()
{
$apikey = $_SERVER['PHP_AUTH_USER'];
if (!isset($apikey) || $apikey != $this->apikey) {
$apikey = "";
if (isset($_SERVER['PHP_AUTH_USER']))
{
$apikey = $_SERVER['PHP_AUTH_USER'];
}
if ($apikey != $this->apikey) {
Logging::info("Invalid API Key: $apikey");
http_response_code(403);
echo "ERROR: Incorrect API key";