fixed captcha to work even in not htmlform environments

added captch field to contact the maintainer form in matrix
added default label to captcha
This commit is contained in:
JT Smith 2006-05-05 20:20:15 +00:00
parent dea8fdc109
commit 6be1d2f76e
4 changed files with 18 additions and 3 deletions

View file

@ -54,6 +54,7 @@
template. (thanks to Jukka Raimovaara / Axxion Oy) template. (thanks to Jukka Raimovaara / Axxion Oy)
- Added a screenshot feature to the matrix. - Added a screenshot feature to the matrix.
- Added an option to delete Matrix fields. - Added an option to delete Matrix fields.
- Added a captcha challenge to the contact the maintainer form in the matrix.
- Added an API for retrieving email from POP3 servers. - Added an API for retrieving email from POP3 servers.
- The rebuildLineage.pl script now finds and fixes orphans, and tries to - The rebuildLineage.pl script now finds and fixes orphans, and tries to
locate circular relationships as well. locate circular relationships as well.

View file

@ -1104,7 +1104,7 @@ sub www_viewDetail {
} }
$var{"discussion"} = $forum->view; $var{"discussion"} = $forum->view;
$var{'isLoggedIn'} = ($self->session->user->userId ne "1"); $var{'isLoggedIn'} = ($self->session->user->userId ne "1");
if ($self->session->form->process("do") eq "sendEmail") { if ($self->session->form->process("do") eq "sendEmail" && $self->session->form->process("verify","captcha")) {
if ($self->session->form->process("body") ne "") { if ($self->session->form->process("body") ne "") {
my $u = WebGUI::User->new($self->session, $listing->{maintainerId}); my $u = WebGUI::User->new($self->session, $listing->{maintainerId});
my $mail = WebGUI::Mail::Send->create($self->session, {to=>$u->profileField("email"),subject=>$listing->{productName}." - ".$self->session->form->process("subject"),from=>$self->session->form->process("from")}); my $mail = WebGUI::Mail::Send->create($self->session, {to=>$u->profileField("email"),subject=>$listing->{productName}." - ".$self->session->form->process("subject"),from=>$self->session->form->process("from")});
@ -1149,6 +1149,9 @@ sub www_viewDetail {
-name=>"listingId", -name=>"listingId",
-value=>$listingId -value=>$listingId
); );
$f->captcha(
-name=>"verify"
);
$f->email( $f->email(
-extras=>'class="content"', -extras=>'class="content"',
-name=>"from", -name=>"from",

View file

@ -47,6 +47,10 @@ See the super class for additional details.
The following additional parameters have been added via this sub class. The following additional parameters have been added via this sub class.
=head3 label
Defaults to "Verify Your Humanity"
=head4 profileEnabled =head4 profileEnabled
Flag that tells the User Profile system that this is a valid form element in a User Profile Flag that tells the User Profile system that this is a valid form element in a User Profile
@ -62,6 +66,9 @@ sub definition {
formName=>{ formName=>{
defaultValue=>$i18n->get("topicName") defaultValue=>$i18n->get("topicName")
}, },
label => {
defaultValue=>$i18n->get("verify your humanity")
},
profileEnabled=>{ profileEnabled=>{
defaultValue=>0 defaultValue=>0
}, },
@ -100,8 +107,7 @@ sub toHtml {
$self->set("size", 6); $self->set("size", 6);
$self->set("maxlength", 6); $self->set("maxlength", 6);
$self->session->scratch->set("captcha_".$self->get("name"), $challenge); $self->session->scratch->set("captcha_".$self->get("name"), $challenge);
$self->set("subtext", '<p style="display:inline;vertical-align:middle;"><img src="'.$storage->getUrl($filename).'" style="border-style:none;vertical-align:middle;" alt="captcha" /></p>'.$self->get("subtext")); return $self->SUPER::toHtml.'<p style="display:inline;vertical-align:middle;"><img src="'.$storage->getUrl($filename).'" style="border-style:none;vertical-align:middle;" alt="captcha" /></p>';
return $self->SUPER::toHtml;
} }
1; 1;

View file

@ -1,6 +1,11 @@
package WebGUI::i18n::English::Form_Captcha; package WebGUI::i18n::English::Form_Captcha;
our $I18N = { our $I18N = {
'verify your humanity' => {
message => q|Verify Your Humanity|,
lastUpdated => 1078852836
},
'topicName' => { 'topicName' => {
message => q|Captcha|, message => q|Captcha|,
context => q|Captcha is an acronym, it cannot be translated.|, context => q|Captcha is an acronym, it cannot be translated.|,