aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-06-23 19:36:23 -0400
committerJoey Hess <joey@kitenet.net>2010-06-23 19:36:23 -0400
commitb38b9327a8f11b642e5f51f7ee537043e25ccff9 (patch)
treef7637ab7ab7eb38ae7dc54205f27670b8aa13f30 /IkiWiki
parentd8e4b51a41a9507584d56946d0eae0e5cef6d6f5 (diff)
downloadikiwiki-b38b9327a8f11b642e5f51f7ee537043e25ccff9.tar
ikiwiki-b38b9327a8f11b642e5f51f7ee537043e25ccff9.tar.gz
take username from email address as fallback
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/openid.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm
index f4ba8db18..f19a559a9 100644
--- a/IkiWiki/Plugin/openid.pm
+++ b/IkiWiki/Plugin/openid.pm
@@ -187,12 +187,17 @@ sub auth ($$) {
$vident->signed_extension_fields('http://openid.net/srv/ax/1.0'),
);
}
+ my $username;
foreach my $ext (@extensions) {
foreach my $field (qw{value.email email}) {
if (exists $ext->{$field} &&
defined $ext->{$field} &&
length $ext->{$field}) {
$session->param(email => $ext->{$field});
+ if (! defined $username &&
+ $ext->{$field}=~/(.+)@.+/) {
+ $username = $1;
+ }
last;
}
}
@@ -200,11 +205,15 @@ sub auth ($$) {
if (exists $ext->{$field} &&
defined $ext->{$field} &&
length $ext->{$field}) {
- $session->param(username => $ext->{$field});
+ $username=$ext->{$field};
last;
}
}
}
+ if (defined $username) {
+ $username=~s/\s+/_/g;
+ $session->param(username => $username);
+ }
}
else {
error("OpenID failure: ".$csr->err);