added DELETE option in CORS header
This commit is contained in:
parent
bbdef13516
commit
e81509a295
@ -19,56 +19,6 @@ char *AdminAuth::login(const String& username, const String& password)
|
||||
adminfile.close();
|
||||
return res;
|
||||
}
|
||||
//char *AdminAuth::login(const char *username, const char *password)
|
||||
//{
|
||||
// char *res = nullptr;
|
||||
// File adminfile = LittleFS.open("admin", "r");
|
||||
// bool current_field = false;
|
||||
// uint16_t current_pos = 0;
|
||||
// Serial.print('-');
|
||||
// while (adminfile.available())
|
||||
// {
|
||||
// char current = adminfile.read();
|
||||
// Serial.print(current);
|
||||
// Serial.print('-');
|
||||
//
|
||||
// if (current == 0x00)
|
||||
// {
|
||||
// if (current_field)
|
||||
// {
|
||||
// if (password[current_pos] == 0x00)
|
||||
// res = tokenbuffer->newToken();
|
||||
// break;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (username[current_pos] != 0x00)
|
||||
// break;
|
||||
// current_pos = 0;
|
||||
// current_field = true;
|
||||
// }
|
||||
// }
|
||||
// else if (current_pos >= MAX_USERNAMEPASSWORD_LENGTH)
|
||||
// break;
|
||||
// else if (!current_field)
|
||||
// {
|
||||
// Serial.print(String(username[current_pos]));
|
||||
// if (username[current_pos] == 0x00 || username[current_pos] != current)
|
||||
// break;
|
||||
// current_pos++;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Serial.print(String(password[current_pos]));
|
||||
// if (password[current_pos] == 0x00 || password[current_pos] != current)
|
||||
// break;
|
||||
// current_pos++;
|
||||
// }
|
||||
// Serial.print(',');
|
||||
// }
|
||||
// adminfile.close();
|
||||
// return res;
|
||||
//}
|
||||
bool AdminAuth::setAuth(const String& username, const String& password)
|
||||
{
|
||||
if (username.length() == 0 || username.length() > MAX_USERNAMEPASSWORD_LENGTH || password.length()==0 || password.length() > MAX_USERNAMEPASSWORD_LENGTH)
|
||||
@ -78,8 +28,6 @@ bool AdminAuth::setAuth(const String& username, const String& password)
|
||||
adminfile.print('\0');
|
||||
adminfile.print(password);
|
||||
adminfile.print('\0');
|
||||
adminfile.seek(0);
|
||||
adminfile.sendAll(Serial);
|
||||
delay(1);
|
||||
adminfile.close();
|
||||
return true;
|
||||
|
@ -56,10 +56,10 @@ namespace webconsole
|
||||
return random(0x30, 0x3A); // Numbers
|
||||
break;
|
||||
case 1:
|
||||
return random(0x41, 0x5B); // Capital Letters
|
||||
return random(0x41, 0x5B); // Capital letters
|
||||
break;
|
||||
case 2:
|
||||
return random(0x61, 0x7B); // Small Letters
|
||||
return random(0x61, 0x7B); // Lowercase letters
|
||||
break;
|
||||
}
|
||||
return 0x21;
|
||||
|
@ -103,7 +103,7 @@ void WebConsole::_sendCORS()
|
||||
{
|
||||
_server->sendHeader("Access-Control-Allow-Origin", "*");
|
||||
_server->sendHeader("Access-Control-Max-Age", "10000");
|
||||
_server->sendHeader("Access-Control-Allow-Methods", "PUT,POST,GET,OPTIONS");
|
||||
_server->sendHeader("Access-Control-Allow-Methods", "PUT,POST,GET,OPTIONS,DELETE");
|
||||
_server->sendHeader("Access-Control-Allow-Headers", "*");
|
||||
}
|
||||
void WebConsole::_handleUnknown()
|
||||
|
Loading…
x
Reference in New Issue
Block a user