diff options
author | Joey Hess <joey@kitenet.net> | 2012-04-04 12:58:36 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-04-04 12:58:36 -0400 |
commit | 93bda514baad6b5e9dce5b6cce62155ac4ba7d68 (patch) | |
tree | e391587467d98e3339127857167280d0cbdbc210 | |
parent | d1849a4deb0256f0ef60a04f123676bcba558120 (diff) | |
download | ikiwiki-93bda514baad6b5e9dce5b6cce62155ac4ba7d68.tar ikiwiki-93bda514baad6b5e9dce5b6cce62155ac4ba7d68.tar.gz |
httpauth: When it's the only auth method, avoid a pointless and confusing signin form, and just right to the httpauthurl.
-rw-r--r-- | IkiWiki/Plugin/httpauth.pm | 14 | ||||
-rw-r--r-- | debian/changelog | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/httpauth.pm b/IkiWiki/Plugin/httpauth.pm index cb488449d..76d574b2a 100644 --- a/IkiWiki/Plugin/httpauth.pm +++ b/IkiWiki/Plugin/httpauth.pm @@ -7,6 +7,7 @@ use strict; use IkiWiki 3.00; 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", @@ -37,6 +38,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; diff --git a/debian/changelog b/debian/changelog index 23c6dc5e3..dd7a5c309 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,8 @@ ikiwiki (3.20120204) UNRELEASED; urgency=low * meta: Support keywords header. Closes: #664780 Thanks, Martin Michlmayr * passwordauth: Fix url in password recovery email to be absolute. + * httpauth: When it's the only auth method, avoid a pointless and + confusing signin form, and just right to the httpauthurl. -- Joey Hess <joeyh@debian.org> Wed, 21 Mar 2012 14:33:14 -0400 |