#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:
parent
db7647aa78
commit
52c598f6a7
|
@ -17,6 +17,7 @@ class GwWifi{
|
||||||
bool fixedApPass=true;
|
bool fixedApPass=true;
|
||||||
bool clientIsConnected=false;
|
bool clientIsConnected=false;
|
||||||
public:
|
public:
|
||||||
|
const char *AP_password = "esp32nmea2k";
|
||||||
GwWifi(const GwConfigHandler *config,GwLog *log, bool fixedApPass=true);
|
GwWifi(const GwConfigHandler *config,GwLog *log, bool fixedApPass=true);
|
||||||
void setup();
|
void setup();
|
||||||
void loop();
|
void loop();
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "GWWifi.h"
|
#include "GWWifi.h"
|
||||||
|
|
||||||
const char *AP_password = "esp32nmea2k";
|
|
||||||
|
|
||||||
GwWifi::GwWifi(const GwConfigHandler *config,GwLog *log, bool fixedApPass){
|
GwWifi::GwWifi(const GwConfigHandler *config,GwLog *log, bool fixedApPass){
|
||||||
this->config=config;
|
this->config=config;
|
||||||
|
|
|
@ -103,8 +103,12 @@ GwConfigHandler config(&logger);
|
||||||
#ifdef GWBUTTON_PIN
|
#ifdef GWBUTTON_PIN
|
||||||
bool fixedApPass=false;
|
bool fixedApPass=false;
|
||||||
#else
|
#else
|
||||||
|
#ifdef FORCE_AP_PWCHANGE
|
||||||
|
bool fixedApPass=false;
|
||||||
|
#else
|
||||||
bool fixedApPass=true;
|
bool fixedApPass=true;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
GwWifi gwWifi(&config,&logger,fixedApPass);
|
GwWifi gwWifi(&config,&logger,fixedApPass);
|
||||||
GwChannelList channels(&logger,&config);
|
GwChannelList channels(&logger,&config);
|
||||||
GwBoatData boatData(&logger);
|
GwBoatData boatData(&logger);
|
||||||
|
@ -420,6 +424,7 @@ class CapabilitiesRequest : public GwRequestMessage{
|
||||||
#ifdef GWBUTTON_PIN
|
#ifdef GWBUTTON_PIN
|
||||||
json["hardwareReset"]="true";
|
json["hardwareReset"]="true";
|
||||||
#endif
|
#endif
|
||||||
|
json["apPwChange"] = fixedApPass?"false":"true";
|
||||||
serializeJson(json,result);
|
serializeJson(json,result);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -473,6 +478,7 @@ protected:
|
||||||
for (StringMap::iterator it = args.begin(); it != args.end(); it++)
|
for (StringMap::iterator it = args.begin(); it != args.end(); it++)
|
||||||
{
|
{
|
||||||
if (it->first.indexOf("_")>= 0) continue;
|
if (it->first.indexOf("_")>= 0) continue;
|
||||||
|
if (it->first == GwConfigDefinitions::apPassword && fixedApPass) continue;
|
||||||
bool rt = config.updateValue(it->first, it->second);
|
bool rt = config.updateValue(it->first, it->second);
|
||||||
if (!rt)
|
if (!rt)
|
||||||
{
|
{
|
||||||
|
@ -741,7 +747,7 @@ void setup() {
|
||||||
GWSYNCHRONIZED(&mainLock);
|
GWSYNCHRONIZED(&mainLock);
|
||||||
userCodeHandler.startUserTasks(MIN_USER_TASK);
|
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.logString("admin pass: %s",config.getString(config.adminPassword).c_str());
|
||||||
logger.logDebug(GwLog::LOG,"setup done");
|
logger.logDebug(GwLog::LOG,"setup done");
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,8 @@
|
||||||
"default": "esp32nmea2k",
|
"default": "esp32nmea2k",
|
||||||
"check": "checkApPass",
|
"check": "checkApPass",
|
||||||
"description": "set the password for the Wifi access point",
|
"description": "set the password for the Wifi access point",
|
||||||
"category": "system"
|
"category": "system",
|
||||||
|
"condition":{"apPwChange":"true"}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "useAdminPass",
|
"name": "useAdminPass",
|
||||||
|
|
Loading…
Reference in New Issue