<%args> $request_type => undef $details => undef $recaptcha_challenge_field => undef $recaptcha_response_field => undef <%method title> Sending A Moderation Request <%init> our($dbh,%session); use utils; use Unicode::String; $r->content_type("text/html; charset=utf-8"); use Captcha::reCAPTCHA; my $c = Captcha::reCAPTCHA->new; % unless(defined($request_type)) { Writing A Moderation Request
<%perl> # Don't bother making logged in users captcha if( ! defined($session{'userid'}) ) { # reCaptcha Output form # Public key print $c->get_html( '6Lf1RwAAAAAAANZIsJS0Ra-ycdARlCNMTzOkkC-v' ); }
Request Type
Details
<%perl> # Check the form results (both of them) } else { my $result; # Verify submission # Don't bother making logged in users captcha if( ! defined($session{'userid'}) ) { $result = $c->check_answer( # Private key '6Lf1RwAAAAAAAP6IcWCSHjdtZ5yh1y2muHE7f1Zy', $ENV{'REMOTE_ADDR'}, $recaptcha_challenge_field, $recaptcha_response_field ); } if ( $result->{is_valid} || defined($session{'userid'}) ) { Thank you for submitting your request. <%perl> my $recipient = $m->base_comp->attr('admin_email'); my $mailtext = " Request Type: $request_type Remote IP address: $ENV{'REMOTE_ADDR'} Details: $details "; #Now send mail to $recipient utils::sendemail( [ $recipient ], "jbovlaste Moderation Request", $mailtext, $session{'username'} ); } else { Captcha failed. <% $recaptcha_challenge_field %>, <% $recaptcha_response_field %> <%perl> } }