LSsession::displayAjaxReturn(): Adjust HTTP returned code on unsuccessfull request

This commit is contained in:
Benjamin Renard 2021-03-11 17:29:20 +01:00
parent 825b5eb52f
commit 3d9b3c2947

View file

@ -1714,6 +1714,10 @@ class LSsession {
// Adjust content-type // Adjust content-type
header('Content-Type: application/json'); header('Content-Type: application/json');
// Adjust HTTP error code on unsuccessfull request
if (isset($data['success']) && !$data['success'] && http_response_code() == 200)
http_response_code(400);
// If redirection set, just redirect user before handling messages/errors to // If redirection set, just redirect user before handling messages/errors to
// keep it in session and show it on next page // keep it in session and show it on next page
if (isset($data['LSredirect']) && (!LSdebugDefined()) ) { if (isset($data['LSredirect']) && (!LSdebugDefined()) ) {