Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enduser_setup module fails for open wifi networks #3374

Closed
blobule opened this issue Jan 17, 2021 · 2 comments
Closed

enduser_setup module fails for open wifi networks #3374

blobule opened this issue Jan 17, 2021 · 2 comments

Comments

@blobule
Copy link
Contributor

blobule commented Jan 17, 2021

Expected behavior

Using enduser_setup, selecting an open network (one without password) is expected to work, but results in 400 bad request error instead.

Actual behavior

Selecting an open network result in a 400 bad request error.
This is due to the fact that the enduser_setup.html page will explicitly disable the password field for open networks. This results in a form that is submitted without the wifi_password field, which is expected to always be there in enduser_setup.c, in function enduser_setup_http_handle_credentials(), line 837:

if (name_str == NULL || pwd_str == NULL)
  {
    ENDUSER_SETUP_DEBUG("Password or SSID string not found");
    return 1;
  }

This "return 1" results in function enduser_setup_handle_POST replying a 400 bad request response.

All that is needed is to remove pwd_str==NULL from the test, and create an empty string instead when pwd_str is NULL.

Test code

Setup a wifi network without password, then do as in the documentation:

enduser_setup.start()

Select the network in the browser page. Notice that the submitted request has no wifi_password field. Error 400 will follow.

I don't have a working copy of nodemcu myself, so I cant submit a pull request. I hope someone can just fix this directly, as this is a simple bug.

NodeMCU startup banner

NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com
	branch: release
	commit: 4f6792773f93f36a7255cfd28dca7aa6c4aa9552
	release: 3.0-release_20201107
	release DTS: 202011071523
	SSL: false
	build type: float
	LFS: 0x0 bytes total capacity
	modules: adc,bit,encoder,enduser_setup,file,gpio,i2c,mdns,mqtt,net,node,rtcmem,rtctime,sntp,tmr,uart,wifi
 build 2021-01-03 22:57 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)

Hardware

Esp8266 on a wemos d1 pro. Not very relevant for this bug...

@HHHartmann
Copy link
Member

HHHartmann commented Jan 18, 2021

Maybe it would be better to change enduser_setup.html to not disable but to hide the password field. Meaning to have a hidden input field

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 16, 2022
@stale stale bot closed this as completed Apr 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants