diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2010-02-04 15:30:41 -0500 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2010-02-04 15:30:41 -0500 |
commit | a2e78ebcf27680eedf30e00f1ee9b86ed1d9e127 (patch) | |
tree | 1647968b52d7c8745b86bdd4bf1ab9467ae673f7 /IkiWiki | |
parent | cfcb3d18808a753a90b042462d1dd71fcb7c82b5 (diff) | |
download | ikiwiki-a2e78ebcf27680eedf30e00f1ee9b86ed1d9e127.tar ikiwiki-a2e78ebcf27680eedf30e00f1ee9b86ed1d9e127.tar.gz |
Add link to userpage (or creation link) to top of preferences page.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/passwordauth.pm | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm index 94c5b0492..b3a798055 100644 --- a/IkiWiki/Plugin/passwordauth.pm +++ b/IkiWiki/Plugin/passwordauth.pm @@ -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>"); + } + } } } |