summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2010-02-11 18:32:07 -0500
committerJoey Hess <joey@gnu.kitenet.net>2010-02-11 18:32:07 -0500
commite6678275a98bd00e888018409998fd67686149c8 (patch)
treeaa571d087f3a910889cf8bded85831c090c0be97 /IkiWiki/Plugin
parente11876b7003c700fbc3717ca9c5af5aac3b72ac2 (diff)
fix logic error
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/httpauth.pm16
1 files changed, 11 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/httpauth.pm b/IkiWiki/Plugin/httpauth.pm
index 202ca1153..5b7d65253 100644
--- a/IkiWiki/Plugin/httpauth.pm
+++ b/IkiWiki/Plugin/httpauth.pm
@@ -75,13 +75,16 @@ sub formbuilder_setup (@) {
}
}
+sub need_httpauth_pagespec () {
+ return defined $config{httpauth_pagespec} &&
+ length $config{httpauth_pagespec} &&
+ defined $config{cgiauthurl};
+}
+
sub test_httpauth_pagespec ($) {
my $page=shift;
- return defined $config{httpauth_pagespec} &&
- length $config{httpauth_pagespec} &&
- defined $config{cgiauthurl} &&
- pagespec_match($page, $config{httpauth_pagespec});
+ pagespec_match($page, $config{httpauth_pagespec});
}
sub canedit ($$$) {
@@ -89,7 +92,9 @@ sub canedit ($$$) {
my $cgi=shift;
my $session=shift;
- if (! defined $cgi->remote_user() && test_httpauth_pagespec($page)) {
+ if (! defined $cgi->remote_user() &&
+ need_httpauth_pagespec() &&
+ ! test_httpauth_pagespec($page)) {
return sub {
IkiWiki::redirect($cgi,
$config{cgiauthurl}.'?'.$cgi->query_string());
@@ -106,6 +111,7 @@ sub pagetemplate (@_) {
my $template=$params{template};
if ($template->param("editurl") &&
+ need_httpauth_pagespec() &&
test_httpauth_pagespec($params{page})) {
# go directly to cgiauthurl when editing a page matching
# the pagespec