]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
authorJoey Hess <joey@kitenet.net>
Wed, 2 Mar 2011 16:40:57 +0000 (12:40 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 2 Mar 2011 16:40:57 +0000 (12:40 -0400)
doc/forum/postsignin_redirect_not_working.mdwn [new file with mode: 0644]
doc/plugins/contrib/justlogin.mdwn
doc/templates/discussion.mdwn

diff --git a/doc/forum/postsignin_redirect_not_working.mdwn b/doc/forum/postsignin_redirect_not_working.mdwn
new file mode 100644 (file)
index 0000000..fdef563
--- /dev/null
@@ -0,0 +1,16 @@
+I'm confused. I got a plugin working that allows a button to call up a login screen but I can't seem to get it to return to the calling page. I end up on the prefs page.
+
+When the plugin first runs it puts the http_referer into a param:
+
+    $session->param("postsignin" => $ENV{HTTP_REFERER} );
+
+Then when it runs for postsignin its supposed to pull it out and send the user to the original page:
+
+    my $page=$q->param("postsignin");
+    ...
+    IkiWiki::redirect($q, $page);
+    exit;
+
+Full code is available on the plugin page: [[plugins/contrib/justlogin]].
+
+I searched the site and there's very little info available for postsignin or redirect. Perhaps I'm using the wrong function?
index b9fc6f6749a9f948769cb67896cd17cab8a7b5e7..ef3d1bfffc29afb8b9227b63a0abe7c04fe5bdb7 100644 (file)
@@ -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
        
index c202ecf4032e3bb9351f04c89925e1bc9960e832..c7115e4d6af1581465a0cdbb3214ace819768d45 100644 (file)
@@ -22,3 +22,6 @@ Am I missing something?  --[[jwalzer]]
 > lines of perl - you'd just need to define a `pagetemplate` hook. --[[smcv]]
 
 Is there a list of all the available variables somewhere, or do I just grep the source for TMPL_VAR?  And is there a way to refer to a variable inside of a wiki page or does it have to be done from a template?  Thanks. -- [[AdamShand]]
+
+I pulled a list of variables and posted it, its in the history for [[templates]] under my name. [[justint]]
+