From 6da202fe7ca3d1cd1e9d3ed370e56d11f663aecf Mon Sep 17 00:00:00 2001 From: "Angus B. Grieve-Smith" Date: Thu, 30 Apr 2020 13:21:56 -0400 Subject: [PATCH] Copy 404 handling to connexion.php --- oauth/connexion.php | 11 ++++++++++- oauth/resource.php | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/oauth/connexion.php b/oauth/connexion.php index 0af596d..f1127c0 100644 --- a/oauth/connexion.php +++ b/oauth/connexion.php @@ -50,8 +50,17 @@ else } catch (Exception $e) { + if ($e->getCode() == 404) { + $resp = json_encode( + [ + "error" => "User not found", + "message" => "$user is not in the group of authorized users." + ] + ); + } else { $resp = json_encode(array("error" => "Impossible to get data", "message" => $e->getMessage())); - $authenticated = false; + } + $authenticated = false; } // If user is authenticated diff --git a/oauth/resource.php b/oauth/resource.php index bd131d8..a93fb59 100755 --- a/oauth/resource.php +++ b/oauth/resource.php @@ -89,7 +89,7 @@ catch (Exception $e) if ($e->getCode() == 404) { $resp = [ "error" => "User not found", - "message" => "$user is not in the group of authorized users." + "message" => "$user is not in the group of authorized users." ]; } else { $resp = array(