Skip to content

Commit

Permalink
Require just password if username is set
Browse files Browse the repository at this point in the history
  • Loading branch information
steadramon committed Oct 14, 2023
1 parent a2f254b commit ec50a93
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ESPGeiger/src/Mqtt/MQTT_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,15 @@ void MQTT_Client::begin()
const char* _mqtt_user = configManager.getParamValueFromID("mqttUser");
const char* _mqtt_pass = configManager.getParamValueFromID("mqttPassword");

if ((_mqtt_server == NULL) || (_mqtt_user == NULL) || (_mqtt_pass == NULL)) {
if (_mqtt_server == NULL) {
mqttEnabled = false;
return;
}
if ((_mqtt_pass != NULL) && (_mqtt_user == NULL)) {
mqttEnabled = false;
return;
}

setServer(configManager.getParamValueFromID("mqttServer"), atoi(configManager.getParamValueFromID("mqttPort")));
setBufferSize(MQTT_MAX_PACKET_SIZE);
setKeepAlive(30);
Expand Down

0 comments on commit ec50a93

Please sign in to comment.