avoid linking directly to ikiwiki.cgi?do=signin
authorJoey Hess <joey@kitenet.net>
Fri, 7 May 2010 21:11:23 +0000 (17:11 -0400)
committerJoey Hess <joey@kitenet.net>
Fri, 7 May 2010 21:11:23 +0000 (17:11 -0400)
Instead, add a custom do=commentsignin, that calls cgi_signin.

This allows a plugin to inject a custom cgi_signin, that uses a different
do= parameter, and have it be used consitently. (This was the only
place to hardcode a link to do=signin.)

IkiWiki/Plugin/comments.pm

index 89560c88b11e803787df08bff66d50836756275c..6d513cd2a070343363ca9eb013f8f497c91ed308 100644 (file)
@@ -251,6 +251,10 @@ sub sessioncgi ($$) {
        elsif ($do eq 'commentmoderation') {
                commentmoderation($cgi, $session);
        }
+       elsif ($do eq 'commentsignin') {
+               IkiWiki::cgi_signin($cgi, $session);
+               exit;
+       }
 }
 
 # Mostly cargo-culted from IkiWiki::plugin::editpage
@@ -328,7 +332,7 @@ sub editcomment ($$) {
 
        if (! defined $session->param('name')) {
                # Make signinurl work and return here.
-               $form->tmpl_param(signinurl => IkiWiki::cgiurl(do => 'signin'));
+               $form->tmpl_param(signinurl => IkiWiki::cgiurl(do => 'commentsignin'));
                $session->param(postsignin => $ENV{QUERY_STRING});
                IkiWiki::cgi_savesession($session);
        }