dokku / dokku-http-auth

dokku plugin that gives the ability to manage HTTP basic auth for an application
MIT License
84 stars 20 forks source link

Only enable basic auth if there are users #22

Closed RealOrangeOne closed 8 months ago

RealOrangeOne commented 1 year ago

This allows the plugin to function as a simple IP restriction filter.

Fixes #16

Untested, but should work :crossed_fingers:

wowu commented 4 months ago

https://github.com/dokku/dokku-http-auth/pull/22/files#diff-986ff2409f1cf5a1d4d73878efffb5ddb64f564799b45be995779bce5922dff4R51

local HAS_ALLOWED_USERS="$(test -s $APP_ROOT/htpasswd || echo "false")"

This variable assignment seems to be wrong.

HAS_ALLOWED_USERS variable is empty when htpasswd exists, which is falsey in sigil, and "false" when it does not exist, which is actually truthy in sigil, so the conditional in template works the other way around.

auth_basic section is not added to nginx config when it should be.

josegonzalez commented 4 months ago

@Wowu would you be interested in making a pull request to fix the functionality?

wowu commented 3 months ago

Sure, submitted #23