Files
OpenMQTT-Gateway/docs
FlorianandClaude Opus 4.7 7904d49dbe Fix/wifimanager portal defaults (#2312)
* [SYS] Don't clobber MQTT/portal defaults with empty form fields

The /wifisave handler unconditionally strcpy'd every form value into the
persisted config, even when WiFiManager surfaced an empty string for a
field the caller omitted. A partial provisioning POST (e.g. only s/p)
silently wiped the compile-time MQTT defaults so the DUT joined WiFi but
never reached the broker.

Mirror the mqtt_pass sentinel guard with strlen() > 0 checks for the
remaining textual fields (server, port, user, topic, name, ota). The
boolean checkboxes and certificate fields already had non-empty guards.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* [DOCS] Document /wifisave provisioning portal API

Add a reference page enumerating the HTTP form fields accepted by the
on-device configuration portal so companion apps and provisioning scripts
can integrate without reading firmware source. Documents the empty-field
ignore semantics introduced in the previous commit and the AP-teardown
response race that callers must tolerate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* [SYS] Also length-guard the MQTT password sentinel branch

The sentinel-only check (form-value != MQTT_PASS) was meant to protect
the stored password against accidental re-saves of the form default,
but it also persists an empty string from a partial / programmatic POST
that omits the `pass` field — empty differs from the sentinel, so the
broker password gets wiped. Add a strlen() > 0 precondition so partial
POSTs preserve the existing password.

Verified on the HIL bench (test_sys/test_wifimanager_portal_partial):
without this commit the DUT joined WiFi but never reached the broker;
with it, LWT-online lands within the reconnect budget.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* [DOCS] Reflect length-guard in /wifisave mqtt_pass semantics

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 14:01:48 -05:00
..