X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/0822b0fc342391bfdb153db2a27792124d7c3f74..cddb39cbf5d385273645f62f15bdf29b7607aac2:/IkiWiki/Plugin/openid.pm diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 57cb139ca..b1a9a7a15 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -42,7 +42,7 @@ sub getsetup () { }, openid_realm => { type => "string", - description => "url of openid realm (default is cgiurl)", + description => "url pattern of openid realm (default is cgiurl)", safe => 0, rebuild => 0, }, @@ -187,12 +187,17 @@ sub auth ($$) { $vident->signed_extension_fields('http://openid.net/srv/ax/1.0'), ); } + my $nickname; 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 $nickname && + $ext->{$field}=~/(.+)@.+/) { + $nickname = $1; + } last; } } @@ -200,11 +205,14 @@ sub auth ($$) { if (exists $ext->{$field} && defined $ext->{$field} && length $ext->{$field}) { - $session->param(username => $ext->{$field}); + $nickname=$ext->{$field}; last; } } } + if (defined $nickname) { + $session->param(nickname => $nickname); + } } else { error("OpenID failure: ".$csr->err);