]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Allow the openid plugin to be loaded but disabled, for its side-effect of defining...
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Sun, 21 Jun 2009 11:09:51 +0000 (12:09 +0100)
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Sun, 21 Jun 2009 11:09:51 +0000 (12:09 +0100)
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

index 5424c57e2c6f8e8093eb56d1aba6aee696a05b39..2c9ada23805f95b7cf145ce410b5f57feff0bd54 100644 (file)
@@ -21,12 +21,25 @@ sub getopt () {
        GetOptions("openidsignup=s" => \$config{openidsignup});
 }
 
        GetOptions("openidsignup=s" => \$config{openidsignup});
 }
 
+sub checkconfig () {
+       if (! defined $config{openidenabled}) {
+               $config{openidenabled} = 1;
+       }
+}
+
 sub getsetup () {
        return
                plugin => {
                        safe => 1,
                        rebuild => 0,
                },
 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/",
                openidsignup => {
                        type => "string",
                        example => "http://myopenid.com/",
@@ -44,6 +57,8 @@ sub formbuilder_setup (@) {
        my $cgi=$params{cgi};
        
        if ($form->title eq "signin") {
        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};
                # Give up if module is unavailable to avoid
                # needing to depend on it.
                eval q{use Net::OpenID::Consumer};