WiFiManager: Entering wrong password to your AP = never ending lock
Wrong password in portal and you are stuck.
My first post, and I will probably piss some one off because I missed something. My deepest apologies in advance!
Hardware
WiFimanager Branch/Release: Master(?) 2.0.15-rc.1
Esp8266
Hardware: ESP-12e, esp01, esp25
Core Version: No clue… Arduindo IDE 2.0.3…?
Description
Problem description // When starting up in “portal mode” and you enter the portal, click on “Configure WiFi”, select your SSID, and enter THE WRONG PASSWORD. // Now you are stuck. A reset (button press) does not help. You have to connect to another network, then close it down do get another try. // Not possible to recover without connecting to another “valid network”
Settings in IDE, STANDARD
Module: NodeMcu, Wemos D1
Additional libraries:
Sketch
// Test, is it a bug if wrong WiFi-AP-password is entered?
// When starting up in "portal mode" and you enter the portal, click on "Configure WiFi", select your SSID, and enter THE WRONG PASSWORD.
// Now you are stuck. A reset (button press) does not help. You have to connect to another network, then close it down do get another try.
// Not possible to recover without connecting to another "valid network"
// Based on: https://github.com/tzapu/WiFiManager/blob/master/examples/NonBlocking/AutoConnectNonBlocking/AutoConnectNonBlocking.ino
// WiFimanager Tzapu 2.0.15-rc.1
// Arduino IDE 2.0
// WEMOS D1 Mini pro ESP8266
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
WiFiManager wm;
void setup() {
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
// put your setup code here, to run once:
Serial.begin(115200);
//reset settings - wipe credentials for testing
//wm.resetSettings();
wm.setConfigPortalBlocking(false);
wm.setConfigPortalTimeout(60);
//automatically connect using saved credentials if they exist
//If connection fails it starts an access point with the specified name
if (wm.autoConnect("AutoConnectAP", "wwwwwwww")) {
Serial.println("connected...yeey :)");
} else {
Serial.println("Configportal running");
}
}
String WiFiString;
String previousWiFiString;
void loop() {
wm.process();
// put your main code here, to run repeatedly:
if (WiFi.status() == WL_IDLE_STATUS) { // when not connected to a network, but powered on
WiFiString = "WL_IDLE_STATUS 0";
} else if (WiFi.status() == WL_NO_SSID_AVAIL) {
WiFiString = "WL_NO_SSID_AVAIL 1 ";
} else if (WiFi.status() == WL_SCAN_COMPLETED) {
WiFiString = "WL_SCAN_COMPLETED 2";
} else if (WiFi.status() == WL_CONNECTED) {
WiFiString = "WL_CONNECTED 3";
} else if (WiFi.status() == WL_CONNECT_FAILED) {
WiFiString = "WL_CONNECT_FAILED 4";
} else if (WiFi.status() == WL_CONNECTION_LOST) {
WiFiString = "WL_CONNECTION_LOST 5 ";
} else if (WiFi.status() == WL_DISCONNECTED) {
WiFiString = "WL_DISCONNECTED 6 ";
}
if (WiFiString != previousWiFiString) {
Serial.print("WiFi.status : ");
Serial.println(WiFiString);
previousWiFiString = WiFiString;
}
}
Debug Messages
/*21:29:22.684 -> {ll��|�l�<�$�c|ǃ��s�#�c��g'�l'o���cp�lrl{lx�n��lĜb'�|���c��gn�dćd`�ng$`'{���o#d�dp�g�;������co�|�c��'o�l`�g'l`o;Ǜ�gc��`s��'c��`�$���d`��g�d*wm:AutoConnect
21:29:22.877 -> *wm:Connecting to SAVED AP: turbo2
21:29:23.358 -> *wm:connectTimeout not set, ESP waitForConnectResult...
21:29:26.629 -> *wm:AutoConnect: FAILED
21:29:26.629 -> *wm:StartAP with SSID: AutoConnectAP
21:29:28.620 -> *wm:AP IP address: 192.168.4.1
21:29:28.620 -> *wm:Starting Web Portal
21:29:28.716 -> Configportal running
21:29:28.716 -> WiFi.status : WL_IDLE_STATUS 0
21:29:57.195 -> *wm:3 networks found
21:30:41.042 -> *wm:4 networks found
21:30:45.309 -> *wm:4 networks found
21:30:56.658 -> *wm:Connecting to NEW AP: turbo2
21:30:56.787 -> *wm:connectTimeout not set, ESP waitForConnectResult...
21:31:03.046 -> *wm:[ERROR] Connect to new AP Failed
21:31:19.638 -> *wm:3 networks found
// Entered the INCORRECT password and saved, and waited...... And nothing. Resetted the device and it comes up in portal mode again. Grrr!
21:32:02.534 -> sd$��|�l�|�d�b|����;�c�c��og�lgn���cp��dsd;lx�o��l��c'�|���c��'o�d��d`�gnl`n{���obd�dp�g�;������co�<�c��o'�$`�no$`gs�ۓo#��`{��o#��`�$Ǐ�$`��g�l*wm:AutoConnect
21:32:02.728 -> *wm:Connecting to SAVED AP: turbo2
21:32:03.304 -> *wm:connectTimeout not set, ESP waitForConnectResult...
21:32:09.270 -> *wm:AutoConnect: FAILED
21:32:09.270 -> *wm:StartAP with SSID: AutoConnectAP
21:32:11.261 -> *wm:AP IP address: 192.168.4.1
21:32:11.261 -> *wm:Starting Web Portal
21:32:11.389 -> Configportal running
21:32:11.389 -> WiFi.status : WL_IDLE_STATUS 0
21:32:27.628 -> *wm:3 networks found
// Entered the CORRECT password and saved, and waited...... And nothing. Resetted the device and it comes up in portal mode again. Grrr!
21:33:11.574 -> ;ld��|�$�|�d�b<����s�b�#��no�$g'���cp��ds$sdp�g��l��c'�|���b��ng�$��l �no$`'{���ocd�lx�n�{�ܜ���co�<�c��no�d`�no$`'{���gcĒ s��'c��`�$���$`��g�d*wm:AutoConnect
21:33:11.767 -> *wm:Connecting to SAVED AP: turbo2
21:33:12.246 -> *wm:connectTimeout not set, ESP waitForConnectResult...
21:33:18.245 -> *wm:AutoConnect: FAILED
21:33:18.245 -> *wm:StartAP with SSID: AutoConnectAP
21:33:20.235 -> *wm:AP IP address: 192.168.4.1
21:33:20.235 -> *wm:Starting Web Portal
21:33:20.363 -> Configportal running
21:33:20.363 -> WiFi.status : WL_IDLE_STATUS 0
*/
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 25
Commits related to this issue
- #1558 fix? Detect password only change — committed to tzapu/WiFiManager by tablatronix 8 months ago
No, the SSID is automatically getting filled by clicking the SSIDs that’s been showing after scan, there is no issue about that. Let me elaborate a bit,
Lets say the portal is being opened for 5 minutes (setConfigPortalTimeout(300)) and the connect timeout is set for 10 seconds (setConnectTimeout(10)).
Now the portal will be opened for 5 minute, and will close either on successful configuration or after timeout (which is 5 minute in this case), and after entering the password, ESP will try to connect for 10 seconds.
During these 5 minutes if I enter a wrong password in the webpage, the ESP will try to connect for 10 seconds and will fail (ERROR Log message will be printed), so for successful connection I have to close the webpage and open it again.
Now my question is, how can I get an error callback(for entering wrong WiFi credentials) after spending 10 seconds of failed attempt while the config portal is still open (while the stack is still running)? In the documentation, there is function setAPCallback() which will return on failed WiFi connection attempt. But it is returning after 5 minutes (setConfigPortalTimeout()).
Looks like it’s the ESP that outputs the SSID in grey if you have a previous successful connection (and now SSID is unavailable). Or if you have a previous unsuccessful connection attempt with incorrect password.
Well it’s easy to go around it by tapping on the correct network in the list when you know it. But at least it fooled me when it looked like it was already in place. ;- )
Do not know what browser-components launched in the phone when accessing “Config portal” from the WiFi-setting. But it’s the same behavior on the following phones:
Xiaomi Redmi Note 8 Pro Kernel 4.14.141-g95d4269 Model M1906g7g Android 10 QP1A.190711.020 MIUI Global 12.0.8 Chrome: 109.0.5414.117
Doogee S96Pro Doogee-s96pro-EEA-Android10.0-20211116 Chrome: 109.0.5414.86
Samsung Galaxy A5 Android 8.0.0
Doogee s98 Android 12