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.
parent
0434f86dd5
commit
ec72b4c95b
|
@ -25,11 +25,15 @@ sub checkconfig () {
|
||||||
# a reference to the normal signin form.
|
# a reference to the normal signin form.
|
||||||
require IkiWiki::CGI;
|
require IkiWiki::CGI;
|
||||||
my $real_cgi_signin;
|
my $real_cgi_signin;
|
||||||
|
my $nonopenidform_label=gettext("Other");
|
||||||
if (keys %{$IkiWiki::hooks{auth}} > 1) {
|
if (keys %{$IkiWiki::hooks{auth}} > 1) {
|
||||||
$real_cgi_signin=\&IkiWiki::cgi_signin;
|
$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 ($$) {
|
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 {
|
sub openid_selector {
|
||||||
my $real_cgi_signin=shift;
|
my $real_cgi_signin=shift;
|
||||||
|
my $nonopenidform_label=shift;
|
||||||
my $q=shift;
|
my $q=shift;
|
||||||
my $session=shift;
|
my $session=shift;
|
||||||
|
|
||||||
|
@ -82,6 +87,7 @@ sub openid_selector {
|
||||||
(defined $openid_error ? (openid_error => $openid_error) : ()),
|
(defined $openid_error ? (openid_error => $openid_error) : ()),
|
||||||
(defined $openid_url ? (openid_url => $openid_url) : ()),
|
(defined $openid_url ? (openid_url => $openid_url) : ()),
|
||||||
($real_cgi_signin ? (nonopenidform => $real_cgi_signin->($q, $session, 1)) : ()),
|
($real_cgi_signin ? (nonopenidform => $real_cgi_signin->($q, $session, 1)) : ()),
|
||||||
|
nonopenidform_label => $nonopenidform_label,
|
||||||
);
|
);
|
||||||
|
|
||||||
IkiWiki::printheader($session);
|
IkiWiki::printheader($session);
|
||||||
|
|
|
@ -2,6 +2,9 @@ ikiwiki (3.20150330) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* Re-remove google from openid selector; their openid provider is
|
* Re-remove google from openid selector; their openid provider is
|
||||||
gone for good.
|
gone for good.
|
||||||
|
* 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.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Tue, 28 Apr 2015 12:24:08 -0400
|
-- Joey Hess <id@joeyh.name> Tue, 28 Apr 2015 12:24:08 -0400
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<script type="text/javascript" src="ikiwiki/openid/openid-jquery.js"></script>
|
<script type="text/javascript" src="ikiwiki/openid/openid-jquery.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
openid.init('openid_identifier','<TMPL_IF NONOPENIDFORM>nonopenidform</TMPL_IF>');
|
openid.init('openid_identifier','<TMPL_IF NONOPENIDFORM>nonopenidform</TMPL_IF>', '<TMPL_VAR NONOPENIDFORM_LABEL>');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ $(document).ready(function() {
|
||||||
<form action="<TMPL_VAR CGIURL>" method="get" id="openid_form">
|
<form action="<TMPL_VAR CGIURL>" method="get" id="openid_form">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<script>
|
<script>
|
||||||
$('fieldset').append("<legend>Select your account provider</legend>");
|
$('fieldset').append("<legend>Select login method</legend>");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<input type="hidden" name="do" value="signin" />
|
<input type="hidden" name="do" value="signin" />
|
||||||
|
@ -36,7 +36,7 @@ $(document).ready(function() {
|
||||||
<TMPL_IF NONOPENIDFORM>
|
<TMPL_IF NONOPENIDFORM>
|
||||||
<br />
|
<br />
|
||||||
<noscript>
|
<noscript>
|
||||||
<h2>Other:</h2>
|
<h2><TMPL_VAR NONOPENIDFORM_LABEL>:</h2>
|
||||||
</noscript>
|
</noscript>
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
<TMPL_VAR NONOPENIDFORM>
|
<TMPL_VAR NONOPENIDFORM>
|
||||||
|
|
|
@ -67,7 +67,7 @@ var openid = {
|
||||||
provider_id: null,
|
provider_id: null,
|
||||||
localsignin_id: null,
|
localsignin_id: null,
|
||||||
|
|
||||||
init: function(input_id, localsignin_id) {
|
init: function(input_id, localsignin_id, localsignin_label) {
|
||||||
|
|
||||||
var openid_btns = $('#openid_btns');
|
var openid_btns = $('#openid_btns');
|
||||||
|
|
||||||
|
@ -89,6 +89,12 @@ var openid = {
|
||||||
openid_btns.append(this.getBoxHTML(providers_small[id], 'small'));
|
openid_btns.append(this.getBoxHTML(providers_small[id], 'small'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (localsignin_label != "") {
|
||||||
|
this.localsignin_label=localsignin_label;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.localsignin_label="other";
|
||||||
|
}
|
||||||
if (localsignin_id != "") {
|
if (localsignin_id != "") {
|
||||||
this.localsignin_id=localsignin_id;
|
this.localsignin_id=localsignin_id;
|
||||||
openid_btns.append(
|
openid_btns.append(
|
||||||
|
@ -96,7 +102,7 @@ var openid = {
|
||||||
' style="background: #FFF" ' +
|
' style="background: #FFF" ' +
|
||||||
'class="localsignin openid_small_btn">' +
|
'class="localsignin openid_small_btn">' +
|
||||||
'<img alt="" width="16" height="16" src="favicon.ico" />' +
|
'<img alt="" width="16" height="16" src="favicon.ico" />' +
|
||||||
' other' +
|
' ' + this.localsignin_label +
|
||||||
'</a>'
|
'</a>'
|
||||||
);
|
);
|
||||||
$('#'+this.localsignin_id).hide();
|
$('#'+this.localsignin_id).hide();
|
||||||
|
|
Loading…
Reference in New Issue