1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-14 22:43:07 +01:00

#34: do not show apPassword in the config UI if the change is not allowed. Also do not print this on startup. Introduce FORCE_AP_PWCHANGE to allow extensions to force pw change ability

This commit is contained in:
andreas
2022-03-10 19:26:19 +01:00
parent db7647aa78
commit 52c598f6a7
4 changed files with 10 additions and 3 deletions

View File

@@ -103,8 +103,12 @@ GwConfigHandler config(&logger);
#ifdef GWBUTTON_PIN
bool fixedApPass=false;
#else
#ifdef FORCE_AP_PWCHANGE
bool fixedApPass=false;
#else
bool fixedApPass=true;
#endif
#endif
GwWifi gwWifi(&config,&logger,fixedApPass);
GwChannelList channels(&logger,&config);
GwBoatData boatData(&logger);
@@ -420,6 +424,7 @@ class CapabilitiesRequest : public GwRequestMessage{
#ifdef GWBUTTON_PIN
json["hardwareReset"]="true";
#endif
json["apPwChange"] = fixedApPass?"false":"true";
serializeJson(json,result);
}
};
@@ -473,6 +478,7 @@ protected:
for (StringMap::iterator it = args.begin(); it != args.end(); it++)
{
if (it->first.indexOf("_")>= 0) continue;
if (it->first == GwConfigDefinitions::apPassword && fixedApPass) continue;
bool rt = config.updateValue(it->first, it->second);
if (!rt)
{
@@ -741,7 +747,7 @@ void setup() {
GWSYNCHRONIZED(&mainLock);
userCodeHandler.startUserTasks(MIN_USER_TASK);
}
logger.logString("wifi AP pass: %s",config.getString(config.apPassword).c_str());
logger.logString("wifi AP pass: %s",fixedApPass? gwWifi.AP_password:config.getString(config.apPassword).c_str());
logger.logString("admin pass: %s",config.getString(config.adminPassword).c_str());
logger.logDebug(GwLog::LOG,"setup done");
}