summaryrefslogtreecommitdiff
path: root/doc/plugins/contrib
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-03-01 12:39:08 -0400
committerJoey Hess <joey@kitenet.net>2011-03-01 12:39:08 -0400
commit9d3467cf4ac8773589a90a9b28e1e726dc417e6d (patch)
tree4ec10b581cf8794ebbea06e81cc4ea64f4a6c548 /doc/plugins/contrib
parent2a2ae88c84da1793fc927b527927fe1c5ae6a7d6 (diff)
parentb156dbdcc25aa5f1e8124d0ae14d9aa75835b606 (diff)
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
Diffstat (limited to 'doc/plugins/contrib')
-rw-r--r--doc/plugins/contrib/justlogin.mdwn65
1 files changed, 65 insertions, 0 deletions
diff --git a/doc/plugins/contrib/justlogin.mdwn b/doc/plugins/contrib/justlogin.mdwn
new file mode 100644
index 000000000..b9fc6f674
--- /dev/null
+++ b/doc/plugins/contrib/justlogin.mdwn
@@ -0,0 +1,65 @@
+This plugin is still in development. Currently it does bring up the login page and the login page does, with proper credentials, log in the user, but the returning page errors.
+
+Place this code into a page:
+
+&lt;form action="http://portable.local/cgi-bin/ikiwiki.cgi" method="get"&gt;
+
+&lt;input type="hidden" name="do" value="justlogin" /&gt;
+
+&lt;input type="submit" value="Login" /&gt;&lt;/form&gt;
+
+
+
+This is the plugin so far:
+
+ #!/usr/bin/perl
+ # Bring up a login page that returns to the calling page
+ package IkiWiki::Plugin::justlogin;
+
+ use warnings;
+ use strict;
+ use IkiWiki 3.00;
+
+ sub import {
+ hook(type => "sessioncgi", id => "justlogin", call => \&sessioncgi);
+ hook(type => "auth", id => "justlogin", call => \&auth);
+ }
+
+ sub sessioncgi ($$) {
+ my $q=shift;
+ my $session=shift;
+
+ debug("jl sessioncgi1 running.");
+
+ if ($q->param('do') eq 'justlogin') {
+ debug("Justlogin do=justlogin running.");
+ if (! defined $session->param("name") ) {
+ debug("Justlogin param!defined running.");
+ $session->param(postsignin => $ENV{HTTP_REFERER} );
+ $session->param("do" => "justgoback" );
+ IkiWiki::cgi_savesession($session);
+ IkiWiki::cgi_signin($q, $session);
+ exit;
+ }
+ } elsif ($session->param('do') eq 'justgoback') {
+ debug("jl justgoback running.");
+ if (! defined $session->param("name")) {
+ debug("Justlogin redir running.");
+ my $page=IkiWiki::possibly_foolish_untaint($q->param('postsignin'));
+ $session->clear("postsignin");
+ $session->clear("do");
+ IkiWiki::cgi_savesession($session);
+ IkiWiki::redirect($q, $page);
+ }
+ }
+ }
+
+ sub auth ($$) {
+ # 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
+