From 56de6c7a1f977c079c3ca8780f516aa340fd51c8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 21 Jun 2009 12:09:51 +0100 Subject: [PATCH] Allow the openid plugin to be loaded but disabled, for its side-effect of defining IkiWiki::openiduser On various sites I have two IkiWiki instances running from the same repository: one accessible via http and only accepting openid logins, and one accessible via authenticated https and only accepting httpauth. Ideally, the https version should still pretty-print OpenIDs seen in git history. --- IkiWiki/Plugin/openid.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 5424c57e2..2c9ada238 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -21,12 +21,25 @@ sub getopt () { GetOptions("openidsignup=s" => \$config{openidsignup}); } +sub checkconfig () { + if (! defined $config{openidenabled}) { + $config{openidenabled} = 1; + } +} + sub getsetup () { return plugin => { safe => 1, rebuild => 0, }, + openidenabled => { + type => "boolean", + example => 1, + description => "allow OpenID logins if openid plugin is loaded?", + safe => 1, + rebuild => 0, + }, openidsignup => { type => "string", example => "http://myopenid.com/", @@ -44,6 +57,8 @@ sub formbuilder_setup (@) { my $cgi=$params{cgi}; if ($form->title eq "signin") { + return unless $config{openidenabled}; + # Give up if module is unavailable to avoid # needing to depend on it. eval q{use Net::OpenID::Consumer}; -- 2.39.5