]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Improve openid url munging; do not display anchors and cgi parameters, as used by...
authorJoey Hess <joey@gnu.kitenet.net>
Sun, 14 Mar 2010 01:10:50 +0000 (20:10 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Sun, 14 Mar 2010 01:10:50 +0000 (20:10 -0500)
IkiWiki.pm
debian/changelog
doc/forum/google_openid_broken__63__.mdwn
t/openiduser.t

index 00eadfd9818e6e41adc36457b6bb45361355817b..251ed8cc81c20403f1da97540e7042d917e5644e 100644 (file)
@@ -1131,7 +1131,7 @@ sub openiduser ($) {
                # Convert "http://somehost.com/user" to "user [somehost.com]".
                # (also "https://somehost.com/user/")
                if ($display !~ /\[/) {
                # Convert "http://somehost.com/user" to "user [somehost.com]".
                # (also "https://somehost.com/user/")
                if ($display !~ /\[/) {
-                       $display=~s/^https?:\/\/(.+)\/([^\/]+)\/?$/$2 [$1]/;
+                       $display=~s/^https?:\/\/(.+)\/([^\/#?]+)\/?(?:[#?].*)?$/$2 [$1]/;
                }
                $display=~s!^https?://!!; # make sure this is removed
                eval q{use CGI 'escapeHTML'};
                }
                $display=~s!^https?://!!; # make sure this is removed
                eval q{use CGI 'escapeHTML'};
index 854d83130b5d9d581ed97b1529126453efbcf3d6..0a96796180a46b66f543a8c516112f74a3aff810 100644 (file)
@@ -4,6 +4,8 @@ ikiwiki (3.20100313) UNRELEASED; urgency=low
     as unsafe.
   * openid: Use Openid Simple Registration or OpenID Attribute Exchange
     to get the user's email address and username.
     as unsafe.
   * openid: Use Openid Simple Registration or OpenID Attribute Exchange
     to get the user's email address and username.
+  * Improve openid url munging; do not display anchors and cgi parameters,
+    as used by yahoo and google urls.
 
  -- Joey Hess <joeyh@debian.org>  Sat, 13 Mar 2010 14:48:10 -0500
 
 
  -- Joey Hess <joeyh@debian.org>  Sat, 13 Mar 2010 14:48:10 -0500
 
index 4ca5cac93a92aacb38e1742a10609d9e77705408..96ba2d79145adbc9c2fdcaba05201a380b57ce6c 100644 (file)
@@ -59,6 +59,12 @@ points to a fairly useless xml document, rather than a web page. --[[Joey]]
 
 > Using the Google profile page as the OpenID is really orthogonal to the above. --[[kaol]]
 
 
 > Using the Google profile page as the OpenID is really orthogonal to the above. --[[kaol]]
 
+>> First, I don't accept that the openid google returns from their 
+>> generic signin url *has* to be so freaking ugly. For contrast, 
+>> look at the openid you log in as if you use the yahoo url.
+>> <https://me.yahoo.com/joeyhess#35f22>. Nice and clean, now
+>> munged by ikiwiki to "joeyhess [me.yahoo.com]".
+>> 
 >> Displaying email addresses is not really an option, because ikiwiki
 >> can't leak user email addresses like that. Displaying nicknames or
 >> usernames is, see [[todo/Separate_OpenIDs_and_usernames]].
 >> Displaying email addresses is not really an option, because ikiwiki
 >> can't leak user email addresses like that. Displaying nicknames or
 >> usernames is, see [[todo/Separate_OpenIDs_and_usernames]].
index 52d879484ce235d55c242d1b2a8d4505fa34f38f..caabbcefc48cb215e4a14be619b56608c8a28785 100755 (executable)
@@ -10,7 +10,7 @@ BEGIN {
                eval q{use Test::More skip_all => "Net::OpenID::VerifiedIdentity not available"};
        }
        else {
                eval q{use Test::More skip_all => "Net::OpenID::VerifiedIdentity not available"};
        }
        else {
-               eval q{use Test::More tests => 9};
+               eval q{use Test::More tests => 11};
        }
        use_ok("IkiWiki::Plugin::openid");
 }
        }
        use_ok("IkiWiki::Plugin::openid");
 }
@@ -28,6 +28,11 @@ $^W=1;
 is(IkiWiki::openiduser('http://yam655.livejournal.com/'), 'yam655 [livejournal.com]');
 is(IkiWiki::openiduser('http://id.mayfirst.org/jamie/'), 'jamie [id.mayfirst.org]');
 
 is(IkiWiki::openiduser('http://yam655.livejournal.com/'), 'yam655 [livejournal.com]');
 is(IkiWiki::openiduser('http://id.mayfirst.org/jamie/'), 'jamie [id.mayfirst.org]');
 
+# yahoo has an anchor in the url
+is(IkiWiki::openiduser('https://me.yahoo.com/joeyhess#35f22'), 'joeyhess [me.yahoo.com]');
+# google urls are horrendous, but the worst bit is after a ?, so can be dropped
+is(IkiWiki::openiduser('https://www.google.com/accounts/o8/id?id=AItOawm-ebiIfxbKD3KNa-Cu9LvvD9edMLW7BAo'), 'id [www.google.com/accounts/o8]');
+
 # and some less typical ones taken from the ikiwiki commit history
 
 is(IkiWiki::openiduser('http://thm.id.fedoraproject.org/'), 'thm [id.fedoraproject.org]');
 # and some less typical ones taken from the ikiwiki commit history
 
 is(IkiWiki::openiduser('http://thm.id.fedoraproject.org/'), 'thm [id.fedoraproject.org]');