authentication : do not display the script for JWT remove if in JSON request

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5823 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2019-12-09 14:23:58 +00:00
parent c3a8bf9c22
commit 366e095e20

View File

@@ -124,7 +124,9 @@ class authentication
// Unset the JSON Web Token as the authentication
if ($this->route->debug)
echo "<tt>Unset the JSON Web Token '$tokenName'</tt><br/>\n";
echo "<script>localStorage.removeItem('$tokenName');</script>\n";
if (! key_exists ("CONTENT_TYPE", $_SERVER) ||
$_SERVER["CONTENT_TYPE"] !== "application/json")
echo "<script>localStorage.removeItem('$tokenName');</script>\n";
$algorithm = "HS256";
$cipherKey = null;
$cacheDir = "data/jwtCache";