]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/loginselector.pm
In rebuilds, assume that every page has been scanned by the time the scan phase ends
[git.ikiwiki.info.git] / IkiWiki / Plugin / loginselector.pm
index b5e2056a409a4351c9a01119e5226079c997364c..26c80b4ce4c3a23423daff216b539217abea0307 100644 (file)
@@ -21,12 +21,13 @@ sub register_login_plugin ($$$$) {
        # This sub is passed a cgi object, and should return true
        # if it looks like the user is logging in using the plugin.
        my $plugin_check_input=shift;
        # This sub is passed a cgi object, and should return true
        # if it looks like the user is logging in using the plugin.
        my $plugin_check_input=shift;
-       # This sub is passed a cgi object, a session object, and an error
-       # display callback, and should handle the actual authentication.
-       # It can either exit w/o returning, if it is able to handle
-       # auth, or it can pass an error message to the error display
-       # callback to make the openid selector form be re-disiplayed with
-       # an error message on it.
+       # This sub is passed a cgi object, a session object, an error
+       # display callback, and an info display callback, and should
+       # handle the actual authentication. It can either exit w/o
+       # returning, if it is able to handle auth, or it can pass an
+       # error message to the error display callback to make the
+       # openid selector form be re-disiplayed with an error message
+       # on it.
        my $plugin_auth=shift;
        $login_plugins{$plugin_name}={
                setup => $plugin_setup,
        my $plugin_auth=shift;
        $login_plugins{$plugin_name}={
                setup => $plugin_setup,
@@ -56,6 +57,8 @@ sub login_selector {
                if ($login_plugins{$plugin}->{check_input}->($q)) {
                        $login_plugins{$plugin}->{auth}->($q, $session, sub {
                                $template->param(login_error => shift());
                if ($login_plugins{$plugin}->{check_input}->($q)) {
                        $login_plugins{$plugin}->{auth}->($q, $session, sub {
                                $template->param(login_error => shift());
+                       }, sub {
+                               $template->param(login_info => shift());
                        });
                        last;
                }
                        });
                        last;
                }
@@ -77,6 +80,7 @@ sub import {
        add_underlay("jquery");
        hook(type => "getsetup", id => "loginselector",  call => \&getsetup);
        hook(type => "checkconfig", id => "loginselector", call => \&checkconfig);
        add_underlay("jquery");
        hook(type => "getsetup", id => "loginselector",  call => \&getsetup);
        hook(type => "checkconfig", id => "loginselector", call => \&checkconfig);
+       hook(type => "auth", id => "loginselector", call => \&authstub);
 }
 
 sub checkconfig () {
 }
 
 sub checkconfig () {
@@ -91,13 +95,14 @@ sub checkconfig () {
                my $otherform_label=gettext("Other");
                if (keys %{$IkiWiki::hooks{auth}} > 1) {
                        $real_cgi_signin=\&IkiWiki::cgi_signin;
                my $otherform_label=gettext("Other");
                if (keys %{$IkiWiki::hooks{auth}} > 1) {
                        $real_cgi_signin=\&IkiWiki::cgi_signin;
+                       # Special case to avoid labeling password auth as
+                       # "Other" when it's the only auth plugin not
+                       # integrated with the loginselector.
                        my %h=%{$IkiWiki::hooks{auth}};
                        foreach my $p (keys %login_plugins) {
                                delete $h{$p};
                        }
                        my %h=%{$IkiWiki::hooks{auth}};
                        foreach my $p (keys %login_plugins) {
                                delete $h{$p};
                        }
-                       # Special case to avoid labeling password auth as
-                       # "Other" when it's the only auth plugin not
-                       # integrated with the loginselector.
+                       delete $h{loginselector};
                        if (keys %h == 1 && exists $h{passwordauth}) {
                                $otherform_label=gettext("Password");
                        }
                        if (keys %h == 1 && exists $h{passwordauth}) {
                                $otherform_label=gettext("Password");
                        }
@@ -118,4 +123,10 @@ sub getsetup () {
                },
 }
 
                },
 }
 
+sub authstub ($$) {
+       # While this hook is not currently used, it needs to exist
+       # so ikiwiki knows that the wiki supports logins, and will
+       # enable the Preferences page.
+}
+
 1
 1