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

@ -1104,7 +1104,7 @@ sub www_viewDetail {
}
$var{"discussion"} = $forum->view;
$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 "") {
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")});
@ -1149,6 +1149,9 @@ sub www_viewDetail {
-name=>"listingId",
-value=>$listingId
);
$f->captcha(
-name=>"verify"
);
$f->email(
-extras=>'class="content"',
-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.
=head3 label
Defaults to "Verify Your Humanity"
=head4 profileEnabled
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=>{
defaultValue=>$i18n->get("topicName")
},
label => {
defaultValue=>$i18n->get("verify your humanity")
},
profileEnabled=>{
defaultValue=>0
},
@ -100,8 +107,7 @@ sub toHtml {
$self->set("size", 6);
$self->set("maxlength", 6);
$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;
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>';
}
1;

View file

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