- if (my $setup_url = $csr->user_setup_url) {
- IkiWiki::redirect($q, $setup_url);
- }
- elsif ($csr->user_cancel) {
- IkiWiki::redirect($q, $config{url});
+ if ($form->title eq "signin") {
+ $form->field(
+ name => "openid_url",
+ label => "OpenID",
+ size => 30,
+ comment => '('.
+ htmllink("", "", "OpenID", 1, 0, "What's this?")
+ .($config{openidsignup} ? " | <a href=\"$config{openidsignup}\">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 => '/.*/');
+ }