diff options
author | Simon McVittie <smcv@debian.org> | 2017-05-14 14:44:43 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2017-05-14 15:37:45 +0100 |
commit | 31c89db246a2e4704e3d4c3784c5406fbd084bb6 (patch) | |
tree | 7b70561571723693e4f3ab1d7f0d59ac447829c9 /IkiWiki | |
parent | 59daf36cb2dfa289814fd89778f6c0000b6d870a (diff) | |
download | ikiwiki-31c89db246a2e4704e3d4c3784c5406fbd084bb6.tar ikiwiki-31c89db246a2e4704e3d4c3784c5406fbd084bb6.tar.gz |
httpauth: If REMOTE_USER is empty, behave as though it was unset
A frequently cut-and-pasted HTTP basic authentication configuration
for nginx sets it to the empty string when not authenticated, which
is not useful.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/httpauth.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/httpauth.pm b/IkiWiki/Plugin/httpauth.pm index 76d574b2a..041eaebc9 100644 --- a/IkiWiki/Plugin/httpauth.pm +++ b/IkiWiki/Plugin/httpauth.pm @@ -66,7 +66,7 @@ sub auth ($$) { my $cgi=shift; my $session=shift; - if (defined $cgi->remote_user()) { + if (length $cgi->remote_user()) { $session->param("name", $cgi->remote_user()); } } @@ -80,7 +80,7 @@ sub formbuilder_setup (@) { my $buttons=$params{buttons}; if ($form->title eq "signin" && - ! defined $cgi->remote_user() && defined $config{cgiauthurl}) { + ! length $cgi->remote_user() && defined $config{cgiauthurl}) { my $button_text="Login with HTTP auth"; push @$buttons, $button_text; @@ -97,7 +97,7 @@ sub canedit ($$$) { my $cgi=shift; my $session=shift; - if (! defined $cgi->remote_user() && + if (! length $cgi->remote_user() && (! defined $session->param("name") || ! IkiWiki::userinfo_get($session->param("name"), "regdate")) && defined $config{httpauth_pagespec} && |