mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-10-18 13:31:28 +08:00

Add Time Support (server + manual setup), only used for ESP32 FS currently as ESP8266 SPIFFS does not support Time, need to wait for LittleFS may be ? Add DHT support Add Pin reset support Add Base for Display Add libraries for new supported features Add /config handle as shortcut for [ESP420]plain to be used in embedded page Code refactoring for defines, use less Define as switches but more define as values for switches Clean warnings Lot of small bug fixes Add docs for [ESPXXX] commands
57 lines
1.9 KiB
C++
57 lines
1.9 KiB
C++
/*
|
|
ESP101.cpp - ESP3D command class
|
|
|
|
Copyright (c) 2014 Luc Lebosse. All rights reserved.
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
#include "../../include/esp3d_config.h"
|
|
#if defined (WIFI_FEATURE)
|
|
#include "../commands.h"
|
|
#include "../esp3doutput.h"
|
|
#include "../settings_esp3d.h"
|
|
#include "../../modules/wifi/wificonfig.h"
|
|
#include "../../modules/authentication/authentication_service.h"
|
|
//STA Password
|
|
//[ESP101]<Password>[pwd=<admin password>]
|
|
bool Commands::ESP101(const char* cmd_params, level_authenticate_type auth_type, ESP3DOutput * output)
|
|
{
|
|
bool response = true;
|
|
String parameter;
|
|
#ifdef AUTHENTICATION_FEATURE
|
|
if (auth_type != LEVEL_ADMIN) {
|
|
output->printERROR("Wrong authentication!", 401);
|
|
return false;
|
|
}
|
|
#else
|
|
(void)auth_type;
|
|
#endif //AUTHENTICATION_FEATURE
|
|
parameter = get_param (cmd_params, "");
|
|
if (!WiFiConfig::isPasswordValid (parameter.c_str() ) ) {
|
|
output->printERROR ("Incorrect password!");
|
|
response = false;
|
|
} else {
|
|
if(!Settings_ESP3D::write_string(ESP_STA_PASSWORD, parameter.c_str())) {
|
|
output->printERROR ("Set failed!");
|
|
response = false;
|
|
} else {
|
|
output->printMSG ("ok");
|
|
}
|
|
}
|
|
return response;
|
|
}
|
|
|
|
#endif //WIFI_FEATURE
|