X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/9a295bec5f361bed184c035651d6168286238b98..edee0db894c7e99911d9ac1b7d9453e477fe0cd6:/IkiWiki/Plugin/httpauth.pm diff --git a/IkiWiki/Plugin/httpauth.pm b/IkiWiki/Plugin/httpauth.pm index 817c2b487..7028130ee 100644 --- a/IkiWiki/Plugin/httpauth.pm +++ b/IkiWiki/Plugin/httpauth.pm @@ -8,6 +8,7 @@ use IkiWiki 3.00; use Data::Dumper; sub import { + hook(type => "checkconfig", id => "httpauth", call => \&checkconfig); hook(type => "getsetup", id => "httpauth", call => \&getsetup); hook(type => "auth", id => "httpauth", call => \&auth); hook(type => "formbuilder_setup", id => "httpauth", @@ -38,6 +39,19 @@ sub getsetup () { rebuild => 0, }, } + +sub checkconfig () { + if ($config{cgi} && defined $config{cgiauthurl} && + keys %{$IkiWiki::hooks{auth}} < 2) { + # There are no other auth hooks registered, so avoid + # the normal signin form, and jump right to httpauth. + require IkiWiki::CGI; + inject(name => "IkiWiki::cgi_signin", call => sub ($$) { + my $cgi=shift; + redir_cgiauthurl($cgi, $cgi->query_string()); + }); + } +} sub redir_cgiauthurl ($;@) { my $cgi=shift;