Skip to content

Commit 27af3b6

Browse files
committed
Fix reset password validation to use strlen for consistency
1 parent f817cc6 commit 27af3b6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void setup(void) {
7777
html += "<h2>Reset Configuration?</h2>";
7878
html += "<p>Are you sure you want to reset the WiFi configuration? This will clear current WiFi settings and restart the device in AP mode.</p>";
7979
html += "<form method='POST' style='display:inline;' accept-charset='UTF-8'>";
80-
if (reset_password != nullptr && String(reset_password).length() > 0) {
80+
if (reset_password != nullptr && strlen(reset_password) > 0) {
8181
html += "<input type='password' name='reset_password' placeholder='Enter reset password' required><br/>";
8282
}
8383
html += "<button type='submit' class='btn btn-yes'>Yes, Reset</button>";
@@ -88,7 +88,7 @@ void setup(void) {
8888
});
8989

9090
server.on("/reset", AsyncWebRequestMethod::HTTP_POST, [](AsyncWebServerRequest *request) {
91-
if (reset_password != nullptr && String(reset_password).length() > 0) {
91+
if (reset_password != nullptr && strlen(reset_password) > 0) {
9292
if (request->hasParam("reset_password", true)) {
9393
if (String(reset_password) == request->getParam("reset_password", true)->value()) {
9494
shouldResetConfig = true;

0 commit comments

Comments
 (0)