passwordauth: Fix url in password recovery email to be absolute.
authorJoey Hess <joey@kitenet.net>
Mon, 2 Apr 2012 16:24:14 +0000 (12:24 -0400)
committerJoey Hess <joey@kitenet.net>
Mon, 2 Apr 2012 16:24:14 +0000 (12:24 -0400)
This got broken when cgiurl began often returning a relative url.
Added a cgiurl_abs for the things that need a guaranteed absolute cgiurl.

IkiWiki.pm
IkiWiki/Plugin/notifyemail.pm
IkiWiki/Plugin/passwordauth.pm
debian/changelog

index 2a83777e6574ec74e9ebb878f0964a88b0118639..f68797ae3b962bc7556308fffa0da5d644c46ca3 100644 (file)
@@ -1092,6 +1092,11 @@ sub cgiurl (@) {
                join("&amp;", map $_."=".uri_escape_utf8($params{$_}), keys %params);
 }
 
+sub cgiurl_abs (@) {
+       eval q{use URI};
+       URI->new_abs(cgiurl(@_), $config{cgiurl});
+}
+
 sub baseurl (;$) {
        my $page=shift;
 
index 58f0c9920716020cbdf38458efbafd3d9d7c4321..9f5a255aeed8487153fee9b0cd63f3f72a0d3e8e 100644 (file)
@@ -127,7 +127,7 @@ sub notify (@) {
                        $template->param(
                                wikiname => $config{wikiname},
                                url => $url,
-                               prefsurl => $config{cgiurl}."?do=prefs",
+                               prefsurl => IkiWiki::cgiurl_abs(do => 'prefs'),
                                showcontent => $showcontent,
                                content => $content,
                        );
index 6a5153efd0d3be38add31947238182862aa9cc02..ac955dc50fd703884d1c54dbf943d9c989c5e454 100644 (file)
@@ -296,7 +296,7 @@ sub formbuilder (@) {
                                my $template=template("passwordmail.tmpl");
                                $template->param(
                                        user_name => $user_name,
-                                       passwordurl => IkiWiki::cgiurl(
+                                       passwordurl => IkiWiki::cgiurl_abs(
                                                'do' => "reset",
                                                'name' => $user_name,
                                                'token' => $token,
index ca1f921167b142b1999553ed3019a0822b38499f..23c6dc5e38e6e49f400ecb6541888915c397db8e 100644 (file)
@@ -11,6 +11,7 @@ ikiwiki (3.20120204) UNRELEASED; urgency=low
     the old hook name is called for now for back-compat.
   * meta: Support keywords header. Closes: #664780
     Thanks, Martin Michlmayr
+  * passwordauth: Fix url in password recovery email to be absolute.
 
  -- Joey Hess <joeyh@debian.org>  Wed, 21 Mar 2012 14:33:14 -0400