Art-of-WiFi / UniFi-API-browser

Tool to browse data exposed by Ubiquiti's UniFi Controller API
MIT License
1.1k stars 150 forks source link

added test to see if users are defined #85

Closed scyto closed 3 years ago

scyto commented 3 years ago

I added this test to index.php to cope with condition when config/users.php exists but where $users in config/users.php is not defined.

It bypasses auth to match the text in config/users.php that says thats what is supposed to happen.

This is designed to solve the issue i raised in https://github.com/Art-of-WiFi/UniFi-API-browser/issues/84.

I am not a coder, this is my first ever real code PR so please go gentle on me if my code is crap.

This can be easily tested by pulling scyto/unifibrowser:noauth - and adding a new variable when running the container called NOAPIBROWSERAUTH - setting to 1 bypasses auth and setting it to 0 keeps auth.

scyto commented 3 years ago

also does this mean the login.php file redundant or would it need the same test too?

malle-pietje commented 3 years ago

also does this mean the login.php file redundant or would it need the same test too?

The login.php file processes the input coming from the login form so it needs to load the config/users.php for the actual authentication. The inclusion of the file in index.php is only needed to determine whether we need to enable the user login form or not.

scyto commented 3 years ago

you included this, so closing as fixed.