]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/openid.pm
refactor check_canchange into IkiWiki library
[git.ikiwiki.info.git] / IkiWiki / Plugin / openid.pm
index f19a559a9e325d2bac6e1309a124e9ed22ed7ac1..fae9fb77f8388a9e750b1d8e7dfdcee700f76a92 100644 (file)
@@ -187,16 +187,16 @@ sub auth ($$) {
                                        $vident->signed_extension_fields('http://openid.net/srv/ax/1.0'),
                                );
                        }
-                       my $username;
+                       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 $username &&
+                                               if (! defined $nickname &&
                                                    $ext->{$field}=~/(.+)@.+/) {
-                                                       $username = $1;
+                                                       $nickname = $1;
                                                }
                                                last;
                                        }
@@ -205,14 +205,14 @@ sub auth ($$) {
                                        if (exists $ext->{$field} &&
                                            defined $ext->{$field} &&
                                            length $ext->{$field}) {
-                                               $username=$ext->{$field};
+                                               $nickname=$ext->{$field};
                                                last;
                                        }
                                }
                        }
-                       if (defined $username) {
-                               $username=~s/\s+/_/g;
-                               $session->param(username => $username);
+                       if (defined $nickname) {
+                               $session->param(nickname =>
+                                       Encode::decode_utf8($nickname));
                        }
                }
                else {