diff options
author | Simon McVittie <smcv@ http://smcv.pseudorandom.co.uk/> | 2008-12-21 16:32:44 +0000 |
---|---|---|
committer | Simon McVittie <smcv@ http://smcv.pseudorandom.co.uk/> | 2008-12-21 16:36:10 +0000 |
commit | e0cd19f30b5cc66450bdb52bd9840c6d8fa774eb (patch) | |
tree | a13ed11224891d1c73002119b475bcd91ece1208 | |
parent | 7bdeee20329e1d1132fbc218c49da75c22f07b03 (diff) |
openid: in &openiduser, let domain-style providers have arbitrarily many subdomains
This leads to better display for OpenIDs like smcv.pseudorandom.co.uk
and thm.id.fedoraproject.org (to take a couple of examples from the
IkiWiki commit history).
-rw-r--r-- | IkiWiki/Plugin/openid.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 2933c9ed9..4acfecf5e 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -191,9 +191,10 @@ sub openiduser ($) { eval q{use Net::OpenID::VerifiedIdentity; 1} && !$@) { my $oid=Net::OpenID::VerifiedIdentity->new(identity => $user); my $display=$oid->display; - # Convert "user.somehost.com" to "user [somehost.com]". + # Convert "user.somehost.com" to "user [somehost.com]" + # (also "user.somehost.co.uk") if ($display !~ /\[/) { - $display=~s/^(.*?)\.([^.]+\.[a-z]+)$/$1 [$2]/; + $display=~s/^([-a-zA-Z0-9]+?)\.([-.a-zA-Z0-9]+\.[a-z]+)$/$1 [$2]/; } # Convert "http://somehost.com/user" to "user [somehost.com]". if ($display !~ /\[/) { |