diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-05-13 12:18:22 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-05-13 12:18:22 -0400 |
commit | ec72b4c95bce640f8b02b7885dad84640b924ffe (patch) | |
tree | 58970eda82487ca68d60c236d428d04f8514d05f /IkiWiki | |
parent | 0434f86dd5edbfa672c644466d070b1af8bc5d3b (diff) | |
download | ikiwiki-ec72b4c95bce640f8b02b7885dad84640b924ffe.tar ikiwiki-ec72b4c95bce640f8b02b7885dad84640b924ffe.tar.gz |
When openid and passwordauth are the only enabled auth plugins, make the openid selector display "Password" instead of "Other", so users are more likely to click on it when they don't have an openid.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/openid.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 107c6adcb..00652ebb7 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -25,11 +25,15 @@ sub checkconfig () { # a reference to the normal signin form. require IkiWiki::CGI; my $real_cgi_signin; + my $nonopenidform_label=gettext("Other"); if (keys %{$IkiWiki::hooks{auth}} > 1) { $real_cgi_signin=\&IkiWiki::cgi_signin; + if (keys %{$IkiWiki::hooks{auth}} == 2 && exists $IkiWiki::hooks{auth}->{passwordauth}) { + $nonopenidform_label=gettext("Password"); + } } inject(name => "IkiWiki::cgi_signin", call => sub ($$) { - openid_selector($real_cgi_signin, @_); + openid_selector($real_cgi_signin, $nonopenidform_label, @_); }); } } @@ -57,6 +61,7 @@ sub getsetup () { sub openid_selector { my $real_cgi_signin=shift; + my $nonopenidform_label=shift; my $q=shift; my $session=shift; @@ -82,6 +87,7 @@ sub openid_selector { (defined $openid_error ? (openid_error => $openid_error) : ()), (defined $openid_url ? (openid_url => $openid_url) : ()), ($real_cgi_signin ? (nonopenidform => $real_cgi_signin->($q, $session, 1)) : ()), + nonopenidform_label => $nonopenidform_label, ); IkiWiki::printheader($session); |