From b43f159cc74babbb907a9143124e0cd5d4c5b23b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 18:34:03 +0000 Subject: [PATCH] doCameraOperation: a failed credential check returns status "error" CMD 3 for a camera (the editor's "Set credentials" button) set status "ok" before the ONVIF check. When the check failed (wrong credentials, unreachable camera, unusable reply), the page saw "ok", reloaded the list and never showed the message. The two failure branches now set status "error", so the reason is shown. Tested through the real ajax_asm.php / web.php login (users table and session id) with the editor's request (UID, SID, CID=5, UU, PP, AU, CMD=3): - camera unreachable: error, "GetCapabilities: Communication error (Failed to connect to ... port 8080 ...)" - fake camera, good: ok, credentials and stream stored - fake camera, HTML 401 page: error, "GetVideoSources: Communication error (HTTP 401: reply is not a SOAP envelope)" - wrong SID: redirected (302) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16 --- lib/controller/doCameraOperation.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/controller/doCameraOperation.php b/lib/controller/doCameraOperation.php index a52ae50..23d061d 100644 --- a/lib/controller/doCameraOperation.php +++ b/lib/controller/doCameraOperation.php @@ -306,9 +306,11 @@ $QS = "UPDATE cameras SET access_login='$EUser', access_pass='$EPass', auth_mode={$AUTH}, ptz_token='{$Eptz}', `status`=1 WHERE id={$CameraID}"; $DATABASE->Query( $QS, false ); } else { + $Data['status'] = 'error'; // the page shows msg only when status is not 'ok' (a failed check was silent) $Data['msg'] = 'Camera was added.
However provided Credentials are Wrong! ['.$EUser.']:['.$EPass.']'; }; } catch( Throwable $e ){ // PHP 8 Errors too: an uncaught Error ended the request without an answer + $Data['status'] = 'error'; $Data['msg'] = 'Provided Credentials are Wrong! ['.$EUser.']:['.$EPass.']
'.htmlspecialchars( $e->getMessage() ); }; } else {