fix(creds): HTTP-Basic-Benutzer optional (Password-only-Geraete)
Wie bei der FritzBox: manche Geraete nutzen HTTP-Basic-Auth nur mit Passwort. Modal speichert HTTP-Creds jetzt bei User ODER Passwort; _do_http wendet die Auth auch bei leerem Benutzer an. SNMP v1/v2c hat ohnehin nur die Community (kein User); v3 braucht den securityName zwingend und bleibt Pflicht. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -238,7 +238,7 @@
|
||||
|
||||
<div style="border:1px solid #1E1E2E;border-radius:6px;padding:10px;">
|
||||
<div style="color:#E0E0F0;font-weight:600;margin-bottom:6px;">HTTP-Basic</div>
|
||||
<input id="dc-http-user" placeholder="Benutzer" style="width:100%;margin-bottom:4px;">
|
||||
<input id="dc-http-user" placeholder="Benutzer (optional)" style="width:100%;margin-bottom:4px;">
|
||||
<input id="dc-http-pass" type="password" placeholder="Passwort" style="width:100%;">
|
||||
</div>
|
||||
|
||||
@@ -4647,8 +4647,10 @@
|
||||
const c = document.getElementById('dc-snmp-community').value.trim();
|
||||
if (c) creds.snmp = { version: v, community: c };
|
||||
}
|
||||
// HTTP-Basic: Benutzer optional (manche Geraete nutzen Password-only).
|
||||
const hu = document.getElementById('dc-http-user').value.trim();
|
||||
if (hu) creds.http = { user: hu, pass: document.getElementById('dc-http-pass').value };
|
||||
const hp = document.getElementById('dc-http-pass').value;
|
||||
if (hu || hp) creds.http = { user: hu, pass: hp };
|
||||
// FritzBox: Benutzer optional (Password-only-Boxen haben keinen) — es reicht
|
||||
// ein Passwort. Gespeichert wird, sobald User ODER Passwort gesetzt ist.
|
||||
const fu = document.getElementById('dc-fb-user').value.trim();
|
||||
|
||||
@@ -622,8 +622,8 @@ def _do_http(action: str, params: dict) -> dict:
|
||||
pass
|
||||
user = params.get("user") or hcreds.get("user")
|
||||
pw = params.get("pass") or params.get("password") or hcreds.get("pass")
|
||||
if user:
|
||||
auth = (str(user), str(pw or ""))
|
||||
if user or pw: # Benutzer optional — manche Geraete nutzen Password-only-Basic-Auth
|
||||
auth = (str(user or ""), str(pw or ""))
|
||||
r = requests.request(method, url, data=params.get("body"),
|
||||
headers=params.get("headers"), auth=auth,
|
||||
timeout=HTTP_TIMEOUT_SEC)
|
||||
|
||||
Reference in New Issue
Block a user