mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-12 20:19:12 +08:00
Fix Authentication flag not transmited in macro [ESP700]
Fix also doc for [ESP201] Thank you @Gi0cas
This commit is contained in:
parent
1697f68f10
commit
5f3c2e91db
@ -54,7 +54,7 @@ if authentication is on, need admin password
|
|||||||
[ESP114]
|
[ESP114]
|
||||||
|
|
||||||
*Get/Set pin value
|
*Get/Set pin value
|
||||||
[ESP201]P<pin> V<value> [PULLUP=YES RAW=YES]
|
[ESP201]P<pin> V<value> [PULLUP=YES RAW=YES]pwd=<admin password>
|
||||||
if no V<value> get P<pin> value
|
if no V<value> get P<pin> value
|
||||||
if V<value> 0/1 set INPUT_PULLUP value, but for GPIO16 INPUT_PULLDOWN_16
|
if V<value> 0/1 set INPUT_PULLUP value, but for GPIO16 INPUT_PULLDOWN_16
|
||||||
GPIO1 and GPIO3 cannot be used as they are used for serial
|
GPIO1 and GPIO3 cannot be used as they are used for serial
|
||||||
|
@ -90,7 +90,7 @@ bool COMMAND::isadmin(String & cmd_params)
|
|||||||
}
|
}
|
||||||
adminpassword = get_param(cmd_params,"pwd=", true);
|
adminpassword = get_param(cmd_params,"pwd=", true);
|
||||||
if (!sadminPassword.equals(adminpassword)) {
|
if (!sadminPassword.equals(adminpassword)) {
|
||||||
LOG("Not allowed\r\n")
|
LOG("Not identified from command line\r\n")
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@ -122,11 +122,28 @@ bool COMMAND::execute_command(int cmd,String cmd_params, tpipe output, level_aut
|
|||||||
level_authenticate_type auth_type = auth_level;
|
level_authenticate_type auth_type = auth_level;
|
||||||
if (isadmin(cmd_params)) {
|
if (isadmin(cmd_params)) {
|
||||||
auth_type = LEVEL_ADMIN;
|
auth_type = LEVEL_ADMIN;
|
||||||
|
LOG("admin identified\r\n");
|
||||||
}
|
}
|
||||||
if (isuser(cmd_params) && (auth_type != LEVEL_ADMIN)) {
|
if (isuser(cmd_params) && (auth_type != LEVEL_ADMIN)) {
|
||||||
auth_type = LEVEL_USER;
|
auth_type = LEVEL_USER;
|
||||||
|
LOG("user identified\r\n");
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG_ESP3D
|
||||||
|
if ( auth_type == LEVEL_ADMIN)
|
||||||
|
{
|
||||||
|
LOG("admin identified\r\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if( auth_type == LEVEL_USER)
|
||||||
|
{
|
||||||
|
LOG("user identified\r\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG("guest identified\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
//manage parameters
|
//manage parameters
|
||||||
byte mode = 254;
|
byte mode = 254;
|
||||||
@ -390,7 +407,7 @@ bool COMMAND::execute_command(int cmd,String cmd_params, tpipe output, level_aut
|
|||||||
break;
|
break;
|
||||||
#ifdef DIRECT_PIN_FEATURE
|
#ifdef DIRECT_PIN_FEATURE
|
||||||
//Get/Set pin value
|
//Get/Set pin value
|
||||||
//[ESP201]P<pin> V<value>
|
//[ESP201]P<pin> V<value> [PULLUP=YES RAW=YES]pwd=<admin password>
|
||||||
case 201:
|
case 201:
|
||||||
parameter = get_param(cmd_params,"", true);
|
parameter = get_param(cmd_params,"", true);
|
||||||
#ifdef AUTHENTICATION_FEATURE
|
#ifdef AUTHENTICATION_FEATURE
|
||||||
@ -1238,7 +1255,7 @@ bool COMMAND::execute_command(int cmd,String cmd_params, tpipe output, level_aut
|
|||||||
}
|
}
|
||||||
//if command is a valid number then execute command
|
//if command is a valid number then execute command
|
||||||
if(cmd_part1.toInt()!=0) {
|
if(cmd_part1.toInt()!=0) {
|
||||||
execute_command(cmd_part1.toInt(),cmd_part2,NO_PIPE);
|
execute_command(cmd_part1.toInt(),cmd_part2,NO_PIPE, auth_type);
|
||||||
}
|
}
|
||||||
//if not is not a valid [ESPXXX] command ignore it
|
//if not is not a valid [ESPXXX] command ignore it
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user