Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

API call /r doesnt clear credentials #25

Closed
AlesSt opened this issue Aug 12, 2020 · 4 comments
Closed

API call /r doesnt clear credentials #25

AlesSt opened this issue Aug 12, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@AlesSt
Copy link

AlesSt commented Aug 12, 2020

Hi,
looks like i ll be nagging a bit more ;)

in:

void ESP_WiFiManager::handleReset function:
WiFi.disconnect(true); // Wipe out WiFi credentials.

and:

void ESP_WiFiManager::resetSettings() function:
#ifdef ESP8266  
  WiFi.disconnect(true);
#else
  WiFi.disconnect(true, true);
#endif

The thing is that erase credentials with disconnect method WORKS only AFTER successful connection to WiFi Router.
I have seen successful "erase" with Wifi.begin("0","0"); but "erase" is actually just overwriting them :)

I will investigate further and if I find something useful I ll post it here :)

EDIT: I forgot to mention also that it worked for a couple of times ........ but in meanwhile i updated lib from 1.0.7 to 1.0.9 and finally to 1.0.10 (by the way static IP gone on CP ... ALL 4 THUMBS UP) and now it works no more :)
I found some discussions: espressif/arduino-esp32#400

@khoih-prog
Copy link
Owner

i updated lib from 1.0.7 to 1.0.9 and finally to 1.0.10 ... now it works no more :)

Could you clarify "now it works no more :)" ???

@khoih-prog khoih-prog added the bug Something isn't working label Aug 13, 2020
@AlesSt
Copy link
Author

AlesSt commented Aug 13, 2020

As already stated in the other bug (the APsoft bug) The thing woked as supposed a few times and I think it cleared credentials ..... (not really sure - i was more checking for errors then if it did as it is suppose to). So yesterday when I checked if this feature was working - result = not working :) so it doesnt clear the saved Wifi credentials.

so what I did was - as by the principal of clean code: dont duplicate things :) i replaced WiFi.disconnect(true); from handleReset with resetSettings(); and also replaced in resetSettings():

#else
  WiFi.disconnect(true, true);
#endif

with:

#else
  Wifi.begin("0","0");
#endif

Meaning, this "solution" solves clearing out Wifi credentials by rewriting 0 instead of SSID and WIFI PASSWORD.
Solution is not to be stuck on but I thing esspressif doesnt have a solution (IDF function) to clear wifi credentials while not connected to it :)

I will dig into this one further after AP soft bug :)

for all the bugs from last night ..... do you want me to branch out and them merge back in? or I can just hand over the snippets?
But for my git branch/merge I will need to check out some tutorials as it would be my first non git clone operation :)

EDIT: Forgot to mention! This workaround is JUST for ESP32 because ESP8266 I couldnt test. If someone plans to test /r functionality just fire up the ConfigPortal and write in browser http://192.168.4.1/r (while connected to ESPs AP wifi ). after ESP restarts, if working it shouldnt connect to wifi any more (repeat process about 10-20x)
so steps to verify:

  • start ESP8266 empty ( no wifi credentials) so ConfigPortal starts)
  • save wifi credentials with call from the browser http://192.168.4.1/ws?s=YOUR_SSID_NAME?p=YOUR_WIFI_PASSWORD or typing in ConfigPortal your SSID and PASS (while connected to ESPs AP wifi.
  • then check if online after restart
  • next shut down your wifi router and restart ESP so that ConfigPortal starts (start your wifi router) and delete wifi credentials with a call http://192.168.4.1/r and after EPS restarts it SHOULDNT connect to your home/work/hobby wifi router.

If ESP connects then credentials werent erased and you dont need to proceed with the test if it DIDNT connect to wifi router then call did what was supposed to do and repeat the whole process at least 20x - if any of them FAILS - stop the test and report back that solution needs to be implemented for ESP8266 too :)

khoih-prog added a commit that referenced this issue Aug 17, 2020
### Releases 1.0.11

1. Add optional **CORS (Cross-Origin Resource Sharing)** feature. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #27: CORS protection fires up with AJAX](#27) and [Cross Origin Resource Sharing](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing). To use, you must explicitly use `#define USING_CORS_FEATURE true`
2. Solve issue softAP with custom IP sometimes not working. Thanks to [AlesSt](https://github.com/AlesSt). See [Issue #26: softAP with custom IP not working](#26) and [Wifi.softAPConfig() sometimes set the wrong IP address](espressif/arduino-esp32#985).
3. Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #25: API call /r doesnt clear credentials](#25) and [WiFi.disconnect(true) problem](espressif/arduino-esp32#400).
4. Fix autoConnect() feature to permit autoConnect() to use STA static IP or DHCP IP. Remove from deprecated functi0n list.
5. Enhance README.md with more instructions and illustrations.
@khoih-prog
Copy link
Owner

Hi @AlesSt

Just inform you that the new ESP_WiFiManager v1.0.11 has been released, certainly with your contribution well noted in Contributions-and-Thanks as well as in library source files.

Releases 1.0.11

  1. Add optional CORS (Cross-Origin Resource Sharing) feature. Thanks to AlesSt. See more in Issue #27: CORS protection fires up with AJAX and Cross Origin Resource Sharing. To use, you must explicitly use #define USING_CORS_FEATURE true
  2. Solve issue softAP with custom IP sometimes not working. Thanks to AlesSt. See Issue #26: softAP with custom IP not working and Wifi.softAPConfig() sometimes set the wrong IP address.
  3. Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32. Thanks to AlesSt. See more in Issue #25: API call /r doesnt clear credentials and WiFi.disconnect(true) problem.
  4. Fix autoConnect() feature to permit autoConnect() to use STA static IP or DHCP IP. Remove from deprecated functi0n list.
  5. Enhance README.md with more instructions and illustrations.

@khoih-prog
Copy link
Owner

Hi @AlesSt

for all the bugs from last night ..... do you want me to branch out and them merge back in? or I can just hand over the snippets?
But for my git branch/merge I will need to check out some tutorials as it would be my first non git clone operation :)

It's certainly be helpful and easier/faster for us if you can fork the library, then make Pull-Request whenever you have enhancement / bug fix for the library. Then you can be an official contributor of the library, and can take care and modify the library in the future when I don't have time and energy to continue. Certainly if you are interested.

I know that's simple for you as a professional programmer, and have seen you work responsibly and efficiently.

Regards,

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants