- if ($form->submitted && $form->validate) {
- if ($form->submitted eq 'Login') {
- $session->param("name", $form->field("name"));
- if (defined $form->field("do") &&
- $form->field("do") ne 'signin') {
- redirect($q, cgiurl(
- do => $form->field("do"),
- page => $form->field("page"),
- title => $form->field("title"),
- subpage => $form->field("subpage"),
- from => $form->field("from"),
- ));
- }
- else {
- redirect($q, $config{url});
- }
- }
- elsif ($form->submitted eq 'Create Account') {
- my $user_name=$form->field('name');
- if (userinfo_setall($user_name, {
- 'email' => $form->field('email'),
- 'password' => $form->field('password'),
- 'regdate' => time
- })) {
- $form->field(name => "confirm_password", type => "hidden");
- $form->field(name => "email", type => "hidden");
- $form->text("Account creation successful. Now you can Login.");
- printheader($session);
- print misctemplate($form->title, $form->render(submit => ["Login"]));
- }
- else {
- error("Error creating account.");
- }
- }
- elsif ($form->submitted eq 'Mail Password') {
- my $user_name=$form->field("name");
- my $template=template("passwordmail.tmpl");
- $template->param(
- user_name => $user_name,
- user_password => userinfo_get($user_name, "password"),
- wikiurl => $config{url},
- wikiname => $config{wikiname},
- REMOTE_ADDR => $ENV{REMOTE_ADDR},
- );
-
- eval q{use Mail::Sendmail};
- error($@) if $@;
- sendmail(
- To => userinfo_get($user_name, "email"),
- From => "$config{wikiname} admin <$config{adminemail}>",
- Subject => "$config{wikiname} information",
- Message => $template->output,
- ) or error("Failed to send mail");
-
- $form->text("Your password has been emailed to you.");
- $form->field(name => "name", required => 0);
- printheader($session);
- print misctemplate($form->title, $form->render(submit => ["Login", "Mail Password"]));
- }
- elsif ($form->submitted eq "Register") {
- printheader($session);
- print misctemplate($form->title, $form->render(submit => ["Create Account"]));
- }
- }
- elsif ($form->submitted eq "Create Account") {
- printheader($session);
- print misctemplate($form->title, $form->render(submit => ["Create Account"]));
+ showform($form, $buttons, $session, $q);
+} #}}}
+
+sub cgi_postsignin ($$) { #{{{
+ my $q=shift;
+ my $session=shift;
+
+ # Continue with whatever was being done before the signin process.
+ if (defined $session->param("postsignin")) {
+ my $postsignin=CGI->new($session->param("postsignin"));
+ $session->clear("postsignin");
+ cgi($postsignin, $session);
+ cgi_savesession($session);
+ exit;