Add link to userpage (or creation link) to top of preferences page.
authorJoey Hess <joey@gnu.kitenet.net>
Thu, 4 Feb 2010 20:30:41 +0000 (15:30 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Thu, 4 Feb 2010 20:30:41 +0000 (15:30 -0500)
IkiWiki/Plugin/passwordauth.pm
debian/changelog

index 94c5b04921c4f31e939559a5f9329d98b9cf5ce0..b3a798055fea9c4315c52be3e8c4794dd17a9e56 100644 (file)
@@ -206,21 +206,35 @@ sub formbuilder_setup (@) {
                        }
                }
        }
-       elsif ($form->title eq "preferences" &&
-              ! IkiWiki::openiduser($session->param("name"))) {
-               $form->field(name => "name", disabled => 1, 
-                       value => $session->param("name"), force => 1,
-                       fieldset => "login");
-               $form->field(name => "password", type => "password",
-                       fieldset => "login",
-                       validate => sub {
-                               shift eq $form->field("confirm_password");
-                       }),
-               $form->field(name => "confirm_password", type => "password",
-                       fieldset => "login",
-                       validate => sub {
-                               shift eq $form->field("password");
-                       }),
+       elsif ($form->title eq "preferences") {
+               my $user=$session->param("name");
+               if (! IkiWiki::openiduser($user)) {
+                       $form->field(name => "name", disabled => 1, 
+                               value => $user, force => 1,
+                               fieldset => "login");
+                       $form->field(name => "password", type => "password",
+                               fieldset => "login",
+                               validate => sub {
+                                       shift eq $form->field("confirm_password");
+                               });
+                       $form->field(name => "confirm_password", type => "password",
+                               fieldset => "login",
+                               validate => sub {
+                                       shift eq $form->field("password");
+                               });
+                       
+                       my $userpage=$config{userdir} ? $config{userdir}."/".$user : $user;
+                       if (exists $pagesources{$userpage}) {
+                               $form->text(gettext("Your user page: ").
+                                       htmllink("", "", $userpage,
+                                               noimageinline => 1));
+                       }
+                       else {
+                               $form->text("<a href=\"".
+                                       IkiWiki::cgiurl(do => "edit", page => $userpage).
+                                       "\">".gettext("Create your user page")."</a>");
+                       }
+               }
        }
 }
 
index 9867cf75a3960b32b40a1082daf01b006fc66990..e07bada2808316c68be2914e2c42746fbd465543 100644 (file)
@@ -7,6 +7,7 @@ ikiwiki (3.20100123) UNRELEASED; urgency=low
   * Allow jumping directly into account registration process by going to 
     ikiwiki.cgi?do=register
   * Improve display of openid in preferences page.
+  * Add link to userpage (or creation link) to top of preferences page.
 
  -- Joey Hess <joeyh@debian.org>  Tue, 26 Jan 2010 22:25:33 -0500