- if ($form->title eq "signin") {
- # Give up if module is unavailable to avoid
- # needing to depend on it.
- eval q{use Net::OpenID::Consumer};
- if ($@) {
- debug("unable to load Net::OpenID::Consumer, not enabling OpenID login ($@)");
- return;
- }
-
- # This avoids it displaying a redundant label for the
- # OpenID fieldset.
- $form->fieldsets("OpenID");
-
- $form->field(
- name => "openid_url",
- label => gettext("Log in with")." ".htmllink("", "", "ikiwiki/OpenID", noimageinline => 1),
- fieldset => "OpenID",
- size => 30,
- comment => ($config{openidsignup} ? " | <a href=\"$config{openidsignup}\">".gettext("Get an OpenID")."</a>" : "")
- );
-
- # Handle submission of an OpenID as validation.
- if ($form->submitted && $form->submitted eq "Login" &&
- defined $form->field("openid_url") &&
- length $form->field("openid_url")) {
- $form->field(
- name => "openid_url",
- validate => sub {
- validate($cgi, $session, shift, $form);
- },
- );
- # Skip all other required fields in this case.
- foreach my $field ($form->field) {
- next if $field eq "openid_url";
- $form->field(name => $field, required => 0,
- validate => '/.*/');
- }
- }
- }
- elsif ($form->title eq "preferences" &&