]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/openid.pm
* Many changes to make ikiwiki very resistant to write failures
[git.ikiwiki.info.git] / IkiWiki / Plugin / openid.pm
index 7ea67c5ca4a34aeaac6f17d0fe23137878fb80e4..5d387fbc6602e5e091203870e01e1a2a43fda294 100644 (file)
@@ -33,8 +33,8 @@ sub formbuilder_setup (@) { #{{{
                        label => "OpenID",
                        size => 30,
                        comment => '('.
                        label => "OpenID",
                        size => 30,
                        comment => '('.
-                               htmllink("", "", "OpenID", 1, 0, "What's this?")
-                               .($config{openidsignup} ? " | <a href=\"$config{openidsignup}\">Get an OpenID</a>" : "")
+                               htmllink("", "", "OpenID", 1, 0, gettext("What's this?"))
+                               .($config{openidsignup} ? " | <a href=\"$config{openidsignup}\">".gettext("Get an OpenID")."</a>" : "")
                                .')'
                );
 
                                .')'
                );
 
@@ -56,6 +56,12 @@ sub formbuilder_setup (@) { #{{{
                        }
                }
        }
                        }
                }
        }
+       elsif ($form->title eq "preferences") {
+               if (! defined $form->field(name => "name")) {
+                       $form->field(name => "OpenID", disabled => 1, value =>
+                               $session->param("name"), size => 50, force => 1);
+               }
+       }
 }
 
 sub validate ($$$;$) { #{{{
 }
 
 sub validate ($$$;$) { #{{{
@@ -134,13 +140,14 @@ sub getobj ($$) { #{{{
        # Store the secret in the session.
        my $secret=$session->param("openid_secret");
        if (! defined $secret) {
        # Store the secret in the session.
        my $secret=$session->param("openid_secret");
        if (! defined $secret) {
-               $secret=$session->param(openid_secret => time);
+               $secret=rand;
+               $session->param(openid_secret => $secret);
        }
 
        return Net::OpenID::Consumer->new(
                ua => $ua,
                args => $q,
        }
 
        return Net::OpenID::Consumer->new(
                ua => $ua,
                args => $q,
-               consumer_secret => $secret,
+               consumer_secret => sub { return shift()+$secret },
                required_root => $config{cgiurl},
        );
 } #}}}
                required_root => $config{cgiurl},
        );
 } #}}}