mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-14 05:15:55 +08:00
Fix display when no Authentication is set
hide login/password menu and pages access
This commit is contained in:
parent
5296770703
commit
a1d2d238c8
@ -100,6 +100,7 @@ void COMMAND::execute_command(int cmd,String cmd_params)
|
|||||||
CONFIG::print_config();
|
CONFIG::print_config();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef AUTHENTICATION_FEATURE
|
||||||
case 555:
|
case 555:
|
||||||
{
|
{
|
||||||
String sadminPassword;
|
String sadminPassword;
|
||||||
@ -117,6 +118,7 @@ void COMMAND::execute_command(int cmd,String cmd_params)
|
|||||||
else Serial.println("\nFailed");
|
else Serial.println("\nFailed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
case 888:
|
case 888:
|
||||||
if (cmd_params=="RESTART") {
|
if (cmd_params=="RESTART") {
|
||||||
Serial.print("\r");
|
Serial.print("\r");
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "wifi.h"
|
#include "wifi.h"
|
||||||
//version and sources location
|
//version and sources location
|
||||||
#define FW_VERSION "0.7.7"
|
#define FW_VERSION "0.7.71"
|
||||||
#define REPOSITORY "https://github.com/luc-github/ESP8266"
|
#define REPOSITORY "https://github.com/luc-github/ESP8266"
|
||||||
|
|
||||||
|
|
||||||
|
@ -540,16 +540,21 @@ void GetFreeMem(STORESTRINGS_CLASS & KeysList, STORESTRINGS_CLASS & ValuesList)
|
|||||||
void GeLogin(STORESTRINGS_CLASS & KeysList, STORESTRINGS_CLASS & ValuesList,level_authenticate_type auth_level)
|
void GeLogin(STORESTRINGS_CLASS & KeysList, STORESTRINGS_CLASS & ValuesList,level_authenticate_type auth_level)
|
||||||
{
|
{
|
||||||
KeysList.add(FPSTR(KEY_DISCONNECT_VISIBILITY));
|
KeysList.add(FPSTR(KEY_DISCONNECT_VISIBILITY));
|
||||||
|
#ifdef AUTHENTICATION_FEATURE
|
||||||
|
|
||||||
if (auth_level != LEVEL_GUEST) {
|
if (auth_level != LEVEL_GUEST) {
|
||||||
ValuesList.add(FPSTR(VALUE_ITEM_VISIBLE));
|
ValuesList.add(FPSTR(VALUE_ITEM_VISIBLE));
|
||||||
KeysList.add(FPSTR(KEY_LOGIN_ID));
|
KeysList.add(FPSTR(KEY_LOGIN_ID));
|
||||||
if (auth_level == LEVEL_ADMIN) ValuesList.add(FPSTR(DEFAULT_ADMIN_LOGIN));
|
if (auth_level == LEVEL_ADMIN) ValuesList.add(FPSTR(DEFAULT_ADMIN_LOGIN));
|
||||||
else ValuesList.add(FPSTR(DEFAULT_USER_LOGIN));
|
else ValuesList.add(FPSTR(DEFAULT_USER_LOGIN));
|
||||||
} else {
|
} else
|
||||||
|
#else
|
||||||
|
{
|
||||||
ValuesList.add(FPSTR(VALUE_ITEM_HIDDEN));
|
ValuesList.add(FPSTR(VALUE_ITEM_HIDDEN));
|
||||||
KeysList.add(FPSTR(KEY_LOGIN_ID));
|
KeysList.add(FPSTR(KEY_LOGIN_ID));
|
||||||
ValuesList.add("");
|
ValuesList.add("");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -1242,6 +1247,7 @@ void handle_web_interface_configSys()
|
|||||||
ValuesList.clear();
|
ValuesList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef AUTHENTICATION_FEATURE
|
||||||
void handle_password()
|
void handle_password()
|
||||||
{
|
{
|
||||||
static const char NOT_AUTH_PW [] PROGMEM = "HTTP/1.1 301 OK\r\nLocation: /LOGIN?return=PASSWORD\r\nCache-Control: no-cache\r\n\r\n";
|
static const char NOT_AUTH_PW [] PROGMEM = "HTTP/1.1 301 OK\r\nLocation: /LOGIN?return=PASSWORD\r\nCache-Control: no-cache\r\n\r\n";
|
||||||
@ -1351,7 +1357,7 @@ void handle_password()
|
|||||||
KeysList.clear();
|
KeysList.clear();
|
||||||
ValuesList.clear();
|
ValuesList.clear();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void handle_web_interface_configAP()
|
void handle_web_interface_configAP()
|
||||||
{
|
{
|
||||||
@ -2904,6 +2910,7 @@ void handle_not_found()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef AUTHENTICATION_FEATURE
|
||||||
void handle_login()
|
void handle_login()
|
||||||
{
|
{
|
||||||
static const char NOT_AUTH_LOG [] PROGMEM = "HTTP/1.1 301 OK\r\nSet-Cookie: ESPSESSIONID=0\r\nLocation: /LOGIN\r\nCache-Control: no-cache\r\n\r\n";
|
static const char NOT_AUTH_LOG [] PROGMEM = "HTTP/1.1 301 OK\r\nSet-Cookie: ESPSESSIONID=0\r\nLocation: /LOGIN\r\nCache-Control: no-cache\r\n\r\n";
|
||||||
@ -2931,7 +2938,6 @@ void handle_login()
|
|||||||
if ( web_interface->WebServer.hasArg("PASSWORD")&& web_interface->WebServer.hasArg("USER")) {
|
if ( web_interface->WebServer.hasArg("PASSWORD")&& web_interface->WebServer.hasArg("USER")) {
|
||||||
//USER
|
//USER
|
||||||
sUser = web_interface->WebServer.arg("USER");
|
sUser = web_interface->WebServer.arg("USER");
|
||||||
#ifdef AUTHENTICATION_FEATURE
|
|
||||||
if ( !((sUser==FPSTR(DEFAULT_ADMIN_LOGIN)) || (sUser==FPSTR(DEFAULT_USER_LOGIN)))) {
|
if ( !((sUser==FPSTR(DEFAULT_ADMIN_LOGIN)) || (sUser==FPSTR(DEFAULT_USER_LOGIN)))) {
|
||||||
msg_alert_error=true;
|
msg_alert_error=true;
|
||||||
smsg.concat(F("Error : Incorrect User<BR>"));
|
smsg.concat(F("Error : Incorrect User<BR>"));
|
||||||
@ -2959,7 +2965,6 @@ void handle_login()
|
|||||||
KeysList.add(FPSTR(KEY_USER_PASSWORD_STATUS));
|
KeysList.add(FPSTR(KEY_USER_PASSWORD_STATUS));
|
||||||
ValuesList.add(FPSTR(VALUE_HAS_ERROR));
|
ValuesList.add(FPSTR(VALUE_HAS_ERROR));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
msg_alert_error=true;
|
msg_alert_error=true;
|
||||||
smsg = FPSTR(MISSING_DATA);
|
smsg = FPSTR(MISSING_DATA);
|
||||||
@ -3034,7 +3039,7 @@ void handle_login()
|
|||||||
KeysList.clear();
|
KeysList.clear();
|
||||||
ValuesList.clear();
|
ValuesList.clear();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
void handle_restart()
|
void handle_restart()
|
||||||
{
|
{
|
||||||
if (SPIFFS.exists("/restart.tpl")) {
|
if (SPIFFS.exists("/restart.tpl")) {
|
||||||
@ -3131,8 +3136,10 @@ WEBINTERFACE_CLASS::WEBINTERFACE_CLASS (int port):WebServer(port)
|
|||||||
#endif
|
#endif
|
||||||
WebServer.on("/FILES", HTTP_ANY, handleFileList,SPIFFSFileupload);
|
WebServer.on("/FILES", HTTP_ANY, handleFileList,SPIFFSFileupload);
|
||||||
WebServer.on("/SDFILES", HTTP_ANY, handleSDFileList,SDFileupload);
|
WebServer.on("/SDFILES", HTTP_ANY, handleSDFileList,SDFileupload);
|
||||||
|
#ifdef AUTHENTICATION_FEATURE
|
||||||
WebServer.on("/LOGIN", HTTP_ANY, handle_login);
|
WebServer.on("/LOGIN", HTTP_ANY, handle_login);
|
||||||
WebServer.on("/PASSWORD", HTTP_ANY, handle_password);
|
WebServer.on("/PASSWORD", HTTP_ANY, handle_password);
|
||||||
|
#endif
|
||||||
//Captive portal Feature
|
//Captive portal Feature
|
||||||
#ifdef CAPTIVE_PORTAL_FEATURE
|
#ifdef CAPTIVE_PORTAL_FEATURE
|
||||||
WebServer.on("/generate_204",HTTP_ANY, handle_web_interface_root);
|
WebServer.on("/generate_204",HTTP_ANY, handle_web_interface_root);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user