}
}
-sub showform ($$$$;@) {
+sub prepform {
my $form=shift;
my $buttons=shift;
my $session=shift;
});
}
+ return $form;
+}
+
+sub showform ($$$$;@) {
+ my $form=prepform(@_);
+ shift;
+ my $buttons=shift;
+ my $session=shift;
+ my $cgi=shift;
+
printheader($session);
print misctemplate($form->title, $form->render(submit => $buttons), @_);
}
}
}
-sub cgi_signin ($$) {
+sub cgi_signin ($$;$) {
my $q=shift;
my $session=shift;
+ my $returnhtml=shift;
decode_cgi_utf8($q);
eval q{use CGI::FormBuilder};
action => $config{cgiurl},
header => 0,
template => {type => 'div'},
- stylesheet => baseurl()."style.css",
+ stylesheet => 1,
);
my $buttons=["Login"];
- if ($q->param("do") ne "signin" && !$form->submitted) {
- $form->text(gettext("You need to log in first."));
- }
$form->field(name => "do", type => "hidden", value => "signin",
force => 1);
$form->validate;
}
+ if ($returnhtml) {
+ $form=prepform($form, $buttons, $session, $q);
+ return $form->render(submit => $buttons);
+ }
+
showform($form, $buttons, $session, $q);
}
params => $q,
action => $config{cgiurl},
template => {type => 'div'},
- stylesheet => baseurl()."style.css",
+ stylesheet => 1,
fieldsets => [
[login => gettext("Login")],
[preferences => gettext("Preferences")],
$form->text(gettext("Preferences saved."));
}
- showform($form, $buttons, $session, $q);
+ showform($form, $buttons, $session, $q,
+ prefsurl => "", # avoid showing the preferences link
+ );
}
sub cgi_custom_failure ($$$) {
foreach my $b (@{$config{banned_users}}) {
if (pagespec_match("", $b,
- ip => $ENV{REMOTE_ADDR},
+ ip => $session->remote_addr(),
name => defined $name ? $name : "",
)) {
$banned=1;