summaryrefslogtreecommitdiff
path: root/doc/plugins
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-03-02 12:40:57 -0400
committerJoey Hess <joey@kitenet.net>2011-03-02 12:40:57 -0400
commit899b8c80a08ef4bf4ebc177045e86859fbef554f (patch)
treecfe44f29c3b382d7c9f92520794170afcebf0be8 /doc/plugins
parent7e4a0c2930afee2249ea5f3eac882460759bc2ae (diff)
parentf512a20c401c8bf2985e3b6a55c80d9578887c78 (diff)
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
Diffstat (limited to 'doc/plugins')
-rw-r--r--doc/plugins/contrib/justlogin.mdwn61
1 files changed, 24 insertions, 37 deletions
diff --git a/doc/plugins/contrib/justlogin.mdwn b/doc/plugins/contrib/justlogin.mdwn
index b9fc6f674..ef3d1bfff 100644
--- a/doc/plugins/contrib/justlogin.mdwn
+++ b/doc/plugins/contrib/justlogin.mdwn
@@ -1,4 +1,4 @@
-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.
+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 goes to prefs. I have no idea why.
Place this code into a page:
@@ -8,11 +8,8 @@ Place this code into a page:
&lt;input type="submit" value="Login" /&gt;&lt;/form&gt;
-
-
This is the plugin so far:
-
- #!/usr/bin/perl
+#!/usr/bin/perl
# Bring up a login page that returns to the calling page
package IkiWiki::Plugin::justlogin;
@@ -21,45 +18,35 @@ This is the plugin so far:
use IkiWiki 3.00;
sub import {
- hook(type => "sessioncgi", id => "justlogin", call => \&sessioncgi);
- hook(type => "auth", id => "justlogin", call => \&auth);
+ hook(type => "sessioncgi", id => "justlogin", call => \&sessioncgi);
}
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.
+ debug("jl sessioncgi1 running.");
+
+ if ($q->param("do") eq "justlogin") {
+ debug("jl do=justlogin running.");
+ if (! defined $session->param("name") ) {
+ debug("jl param!defined running.");
+ $session->param("postsignin" => $ENV{HTTP_REFERER} );
+ $session->param("do" => "justgoback" );
+ IkiWiki::cgi_signin($q, $session);
+ IkiWiki::cgi_savesession($session);
+ }
+ exit;
+ } elsif ($session->param("do") eq "justgoback") {
+ debug("jl justgoback running.");
+ my $page=$q->param("postsignin");
+ $session->clear("postsignin");
+ $session->clear("do");
+ IkiWiki::cgi_savesession($session);
+ IkiWiki::redirect($q, $page);
+ exit;
+ }
}
-
1