- elsif ($csr->user_cancel) {
- IkiWiki::redirect($q, $config{url});
- }
- elsif (my $vident = $csr->verified_identity) {
- $session->param(name => $vident->url);
- }
- else {
- error("OpenID failure: ".$csr->err);
+
+ # 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 => '/.*/');
+ }