projects
/
ikiwiki.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f735e2d
)
moved non-openid signin form into same page as openid selector; show/hide as buttons...
author
Joey Hess
<joey@kitenet.net>
Sat, 8 May 2010 19:57:39 +0000
(15:57 -0400)
committer
Joey Hess
<joey@kitenet.net>
Sat, 8 May 2010 19:57:39 +0000
(15:57 -0400)
IkiWiki/CGI.pm
patch
|
blob
|
history
IkiWiki/Plugin/openid.pm
patch
|
blob
|
history
templates/openid-selector.tmpl
patch
|
blob
|
history
underlays/openid-selector/ikiwiki/openid/openid-jquery.js
patch
|
blob
|
history
diff --git
a/IkiWiki/CGI.pm
b/IkiWiki/CGI.pm
index 49a505514310be1be0e1b36c6064906964cb8f1a..b98e9e0a1b5f45ad2cd6cc6f785a39c616a1e676 100644
(file)
--- a/
IkiWiki/CGI.pm
+++ b/
IkiWiki/CGI.pm
@@
-22,7
+22,7
@@
sub printheader ($) {
}
}
}
}
-sub
showform ($$$$;@)
{
+sub
prepform
{
my $form=shift;
my $buttons=shift;
my $session=shift;
my $form=shift;
my $buttons=shift;
my $session=shift;
@@
-35,6
+35,16
@@
sub showform ($$$$;@) {
});
}
});
}
+ return $form;
+}
+
+sub showform ($$$$;@) {
+ my $form=prepform(@_);
+ shift;
+ my $buttons=shift;
+ my $session=shift;
+ my $cgi=shift;
+
printheader($session);
print misctemplate($form->title, $form->render(submit => $buttons), @_);
}
printheader($session);
print misctemplate($form->title, $form->render(submit => $buttons), @_);
}
@@
-90,9
+100,10
@@
sub needsignin ($$) {
}
}
}
}
-sub cgi_signin ($$) {
+sub cgi_signin ($$
;$
) {
my $q=shift;
my $session=shift;
my $q=shift;
my $session=shift;
+ my $returnhtml=shift;
decode_cgi_utf8($q);
eval q{use CGI::FormBuilder};
decode_cgi_utf8($q);
eval q{use CGI::FormBuilder};
@@
-112,9
+123,6
@@
sub cgi_signin ($$) {
);
my $buttons=["Login"];
);
my $buttons=["Login"];
- if ($q->param("do") ne "signin" && !$form->submitted) {
- $form->text(gettext("You need to log in first."));
- }
$form->field(name => "do", type => "hidden", value => "signin",
force => 1);
$form->field(name => "do", type => "hidden", value => "signin",
force => 1);
@@
-129,6
+137,11
@@
sub cgi_signin ($$) {
$form->validate;
}
$form->validate;
}
+ if ($returnhtml) {
+ $form=prepform($form, $buttons, $session, $q);
+ return $form->render(submit => $buttons);
+ }
+
showform($form, $buttons, $session, $q);
}
showform($form, $buttons, $session, $q);
}
diff --git
a/IkiWiki/Plugin/openid.pm
b/IkiWiki/Plugin/openid.pm
index d75099ce9c0baa4e3127f442f9ba38d9157aced9..e10e21f4d6f9eed60be8cfa8650b9ddf9391b1a6 100644
(file)
--- a/
IkiWiki/Plugin/openid.pm
+++ b/
IkiWiki/Plugin/openid.pm
@@
-62,17
+62,13
@@
sub openid_selector {
$openid_error=shift;
});
}
$openid_error=shift;
});
}
- elsif ($q->param("do") eq "signin" && $real_cgi_signin) {
- $real_cgi_signin->($q, $session);
- exit;
- }
my $template=IkiWiki::template("openid-selector.tmpl");
$template->param(
cgiurl => $config{cgiurl},
(defined $openid_error ? (openid_error => $openid_error) : ()),
(defined $openid_url ? (openid_url => $openid_url) : ()),
my $template=IkiWiki::template("openid-selector.tmpl");
$template->param(
cgiurl => $config{cgiurl},
(defined $openid_error ? (openid_error => $openid_error) : ()),
(defined $openid_url ? (openid_url => $openid_url) : ()),
- ($real_cgi_signin ? (nonopenid
url => IkiWiki::cgiurl(do => "signin"
)) : ()),
+ ($real_cgi_signin ? (nonopenid
form => $real_cgi_signin->($q, $session, 1
)) : ()),
);
IkiWiki::printheader($session);
);
IkiWiki::printheader($session);
diff --git
a/templates/openid-selector.tmpl
b/templates/openid-selector.tmpl
index 7e5ae9a01bfcacb0149dfa07b3fc5186716c51fe..b4d0e314f5ad0cd2997cafc8a138c5be892a715d 100644
(file)
--- a/
templates/openid-selector.tmpl
+++ b/
templates/openid-selector.tmpl
@@
-2,21
+2,18
@@
<script type="text/javascript" src="ikiwiki/openid/openid-jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
<script type="text/javascript" src="ikiwiki/openid/openid-jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
- openid.init('openid_identifier',
"<TMPL_VAR NONOPENIDURL>"
);
+ openid.init('openid_identifier',
'<TMPL_IF NONOPENIDFORM>nonopenidform</TMPL_IF>'
);
});
</script>
});
</script>
-
+
+<noscript>
+<h2>OpenID:</h2>
+</noscript>
+
<form action="<TMPL_VAR CGIURL>" method="get" id="openid_form">
<fieldset>
<legend>Select your account provider</legend>
<form action="<TMPL_VAR CGIURL>" method="get" id="openid_form">
<fieldset>
<legend>Select your account provider</legend>
-
- <noscript>
- <ul>
- <TMPL_IF NONOPENIDURL>
- <li><a href="<TMPL_VAR NONOPENIDURL>">Local Account</a></li>
- </TMPL_IF>
- <li>OpenID:</div>
- </noscript>
+
<input type="hidden" name="do" value="signin" />
<input type="hidden" name="action" value="verify" />
<div id="openid_choice">
<input type="hidden" name="do" value="signin" />
<input type="hidden" name="action" value="verify" />
<div id="openid_choice">
@@
-29,9
+26,15
@@
$(document).ready(function() {
<TMPL_IF OPENID_ERROR>
<div class="error"><TMPL_VAR OPENID_ERROR></div>
</TMPL_IF>
<TMPL_IF OPENID_ERROR>
<div class="error"><TMPL_VAR OPENID_ERROR></div>
</TMPL_IF>
- <noscript>
- </li>
- </ul>
- </noscript>
</fieldset>
</form>
</fieldset>
</form>
+
+<div id="nonopenidform">
+<TMPL_IF NONOPENIDFORM>
+<br />
+<noscript>
+<h2>Local Account:</h2>
+</noscript>
+</TMPL_IF>
+<TMPL_VAR NONOPENIDFORM>
+</div>
diff --git
a/underlays/openid-selector/ikiwiki/openid/openid-jquery.js
b/underlays/openid-selector/ikiwiki/openid/openid-jquery.js
index 59a59c0843f03479bfcf5e54488afa2e4d355b82..bf14fd3d58785a488665bb0883c63790dce15281 100644
(file)
--- a/
underlays/openid-selector/ikiwiki/openid/openid-jquery.js
+++ b/
underlays/openid-selector/ikiwiki/openid/openid-jquery.js
@@
-82,8
+82,9
@@
var openid = {
input_id: null,
provider_url: null,
provider_id: null,
input_id: null,
provider_url: null,
provider_id: null,
+ localsignin_id: null,
- init: function(input_id, local
loginurl
) {
+ init: function(input_id, local
signin_id
) {
var openid_btns = $('#openid_btns');
var openid_btns = $('#openid_btns');
@@
-105,13
+106,14
@@
var openid = {
openid_btns.append(this.getBoxHTML(providers_small[id], 'small'));
}
}
openid_btns.append(this.getBoxHTML(providers_small[id], 'small'));
}
}
- if (localloginurl != "") {
+ if (localsignin_id != "") {
+ this.localsignin_id=localsignin_id;
openid_btns.append(
openid_btns.append(
- '<a href="
' + localloginurl + '
"' +
+ '<a href="
javascript: openid.signin(\'localsignin\');
"' +
' style="background: #FFF" ' +
' style="background: #FFF" ' +
- 'class="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" />' +
- '
Local Account
' +
+ '
other
' +
'</a>'
);
}
'</a>'
);
}
@@
-143,7
+145,20
@@
var openid = {
},
/* Provider image click */
signin: function(box_id, onload) {
},
/* Provider image click */
signin: function(box_id, onload) {
-
+
+ if (box_id == 'localsignin') {
+ this.highlight(box_id);
+ $('#openid_input_area').empty();
+ $('#'+this.localsignin_id).show();
+ this.setCookie(box_id);
+ return;
+ }
+ else {
+ if (this.localsignin_id) {
+ $('#'+this.localsignin_id).hide();
+ }
+ }
+
var provider = providers[box_id];
if (! provider) {
return;
var provider = providers[box_id];
if (! provider) {
return;