Spammers (or their bots) have taken to spamming the TestBot's feedback page. As if that was going to egt them anywhere! The captcha is only required for users who are not logged in obviously.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/web/Feedback.pl | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/testbot/web/Feedback.pl b/testbot/web/Feedback.pl index 36f0a2b06..b43397fda 100644 --- a/testbot/web/Feedback.pl +++ b/testbot/web/Feedback.pl @@ -33,16 +33,21 @@ sub _initialize($$$) { my ($self, $Request, $RequiredRole) = @_;
+ my $Session = $self->GetCurrentSession(); my @PropertyDescriptors = ( CreateBasicPropertyDescriptor("Name", "Name", !1, !1, "A", 40), CreateBasicPropertyDescriptor("EMail", "Email", !1, !1, "A", 40), CreateBasicPropertyDescriptor("Remarks", "Remarks", !1, 1, "textarea", 1024), ); + if (!$Session and $RegistrationQ) + { + $self->GetParam("FeedA", "") if (!defined $self->GetParam("FeedA")); + push @PropertyDescriptors, CreateBasicPropertyDescriptor("FeedA", "Please demonstrate you are not a bot by answering this question: $RegistrationQ", !1, 1, "A", 40); + }
$self->SUPER::_initialize($Request, $RequiredRole, @PropertyDescriptors);
- my $Session = $self->GetCurrentSession(); - if (defined($Session)) + if ($Session) { # Provide default values my $User = $Session->User; @@ -79,6 +84,17 @@ sub OnSend($) { my ($self) = @_;
+ my $Session = $self->GetCurrentSession(); + if (!$Session and $RegistrationQ) + { + my $FeedA = $self->GetParam("FeedA"); + if ($FeedA !~ /$RegistrationARE/) + { + $self->{ErrMessage} = "Wrong 'captcha' answer. Please try again."; + $self->{ErrField} = "Captcha"; + return !1; + } + } if (! $self->Validate) { return !1;