Duo Push sent
");
response.print("Please confirm login in the Duo app
");
@@ -2035,7 +1860,7 @@ bool WebCfgServer::processLogin(PsychicRequest *request, PsychicResponse* resp)
durationLength = _preferences->getInt(preference_cred_session_lifetime, 3600);
}
- _sessionsOpts[request->client()->localIP().toString()] = request->hasParam("remember");
+ _importExport->_sessionsOpts[request->client()->localIP().toString()] = request->hasParam("remember");
if (!_isSSL)
{
@@ -2072,118 +1897,12 @@ esp_err_t WebCfgServer::sendSettings(PsychicRequest *request, PsychicResponse* r
if(p->value() == "https")
{
name = "nuki_hub_http_ssl.json";
- if (!SPIFFS.begin(true)) {
- Log->println("SPIFFS Mount Failed");
- }
- else
- {
- File file = SPIFFS.open("/http_ssl.crt");
- if (!file || file.isDirectory()) {
- Log->println("http_ssl.crt not found");
- }
- else
- {
- Log->println("Reading http_ssl.crt");
- size_t filesize = file.size();
- char cert[filesize + 1];
-
- file.read((uint8_t *)cert, sizeof(cert));
- file.close();
- cert[filesize] = '\0';
- json["http_ssl.crt"] = cert;
- }
- }
-
- if (!SPIFFS.begin(true)) {
- Log->println("SPIFFS Mount Failed");
- }
- else
- {
- File file = SPIFFS.open("/http_ssl.key");
- if (!file || file.isDirectory()) {
- Log->println("http_ssl.key not found");
- }
- else
- {
- Log->println("Reading http_ssl.key");
- size_t filesize = file.size();
- char key[filesize + 1];
-
- file.read((uint8_t *)key, sizeof(key));
- file.close();
- key[filesize] = '\0';
- json["http_ssl.key"] = key;
- }
- }
+ _importExport->exportHttpsJson(json);
}
else
{
name = "nuki_hub_mqtt_ssl.json";
- if (!SPIFFS.begin(true)) {
- Log->println("SPIFFS Mount Failed");
- }
- else
- {
- File file = SPIFFS.open("/mqtt_ssl.ca");
- if (!file || file.isDirectory()) {
- Log->println("mqtt_ssl.ca not found");
- }
- else
- {
- Log->println("Reading mqtt_ssl.ca");
- size_t filesize = file.size();
- char ca[filesize + 1];
-
- file.read((uint8_t *)ca, sizeof(ca));
- file.close();
- ca[filesize] = '\0';
- json["mqtt_ssl.ca"] = ca;
- }
- }
-
- if (!SPIFFS.begin(true)) {
- Log->println("SPIFFS Mount Failed");
- }
- else
- {
- File file = SPIFFS.open("/mqtt_ssl.crt");
- if (!file || file.isDirectory()) {
- Log->println("mqtt_ssl.crt not found");
- }
- else
- {
- Log->println("Reading mqtt_ssl.crt");
- size_t filesize = file.size();
- char cert[filesize + 1];
-
- file.read((uint8_t *)cert, sizeof(cert));
- file.close();
- cert[filesize] = '\0';
- json["mqtt_ssl.crt"] = cert;
- }
- }
-
- if (!SPIFFS.begin(true)) {
- Log->println("SPIFFS Mount Failed");
- }
- else
- {
- File file = SPIFFS.open("/mqtt_ssl.key");
- if (!file || file.isDirectory()) {
- Log->println("mqtt_ssl.key not found");
- }
- else
- {
- Log->println("Reading mqtt_ssl.key");
- size_t filesize = file.size();
- char key[filesize + 1];
-
- file.read((uint8_t *)key, sizeof(key));
- file.close();
- key[filesize] = '\0';
- json["mqtt_ssl.key"] = key;
- }
- }
+ _importExport->exportMqttsJson(json);
}
}
else
@@ -2208,188 +1927,7 @@ esp_err_t WebCfgServer::sendSettings(PsychicRequest *request, PsychicResponse* r
pairing = true;
}
}
-
- DebugPreferences debugPreferences;
-
- const std::vector