]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/plugins/contrib/justlogin.mdwn
add instructions for seeing web server logs
[git.ikiwiki.info.git] / doc / plugins / contrib / justlogin.mdwn
1 This plugin has been abandoned while 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. I decided to go in another direction so if someone wants to take over then please do so. Otherwise I have no problem if this page needs to be deleted. [[users/justint/]]
3 Place this code into a page:
5 <form action="http://portable.local/cgi-bin/ikiwiki.cgi" method="get">
7 <input type="hidden" name="do" value="justlogin" />
9 <input type="submit" value="Login" /></form>
11 This is the plugin so far:
12 #!/usr/bin/perl
13         # Bring up a login page that returns to the calling page
14         package IkiWiki::Plugin::justlogin;
15         
16         use warnings;
17         use strict;
18         use IkiWiki 3.00;
19         
20         sub import {
21                 hook(type => "sessioncgi", id => "justlogin", call => \&sessioncgi);
22         }
23         
24         sub sessioncgi ($$) {
25                 my $q=shift;
26                 my $session=shift;
27         
28                 debug("jl sessioncgi1 running.");
29         
30                 if ($q->param("do") eq "justlogin") {
31                         debug("jl do=justlogin running.");
32                         if (! defined $session->param("name") ) {
33                                 debug("jl param!defined running.");
34                                 $session->param("postsignin" => $ENV{HTTP_REFERER} );
35                                 $session->param("do" => "justgoback" );
36                                 IkiWiki::cgi_signin($q, $session);
37                                 IkiWiki::cgi_savesession($session);
38                         }
39                         exit;
40                 } elsif ($session->param("do") eq "justgoback") {
41                         debug("jl justgoback running.");
42                         my $page=$q->param("postsignin");
43                         $session->clear("postsignin");
44                         $session->clear("do");
45                         IkiWiki::cgi_savesession($session);
46                         IkiWiki::redirect($q, $page);
47                         exit;
48                 }
49         }
50         
51         1
52