I Copied and modified most of his howto to work with 5.0.x
Part 0: get a key set https://www.google.com/recaptcha/admin/create
Part 1: install reCAPTCHA
Code: Select all
cpan Captcha::reCAPTCHA
Part 2: Copy Custom Files
Code: Select all
cd /opt/otrs
mkdir -p Kernel/Output/HTML/Templates/Standard
cp ../Kernel/Output/HTML/Layout.pm Kernel/Output/HTML/Layout.pm
cp ../Kernel/Output/HTML/Templates/Standard/CustomerLogin.tt Kernel/Output/HTML/Templates/Standard/CustomerLogin.tt
mkdir -p Custom/Kernel/System/Web
cp ../Kernel/System/Web/InterfaceCustomer.pm Custom/Kernel/System/Web/InterfaceCustomer.pm Kernel/System/Web/InterfaceCustomer.pm Custom/Kernel/System/Web/InterfaceCustomer.pm
in the top where the use section is, add
Code: Select all
use Captcha::reCAPTCHA;
Code: Select all
# get create account output
if (
$ConfigObject->Get('CustomerPanelCreateAccount')
&& $ConfigObject->Get('Customer::AuthModule') eq
'Kernel::System::CustomerAuth::DB'
)
{
#begin recaptcha
my $rc = Captcha::reCAPTCHA->new;
my $rccustom = "<script type= \"text/javascript\">\n
var RecaptchaOptions = {\n
lang : 'en',
};\n
</script>\n";
$Param{reCAPTCHA} = $rccustom . $rc->get_html(" ****PUBLIC KEY**** "); #public key
#end recaptcha
$Self->Block(
Name => 'CreateAccountLink',
Data => \%Param,
);
$Self->Block(
Name => 'CreateAccount',
Data => \%Param,
);
in the top where the use section is, add
Code: Select all
use Captcha::reCAPTCHA;
Code: Select all
# check needed params
if ( !$GetParams{UserCustomerID} ) {
$GetParams{UserCustomerID} = $GetParams{UserEmail};
}
if ( !$GetParams{UserLogin} ) {
$GetParams{UserLogin} = $GetParams{UserEmail};
}
# check reCAPTCHA
my $rc = Captcha::reCAPTCHA->new;
my $challenge = $ParamObject->GetParam(Param => 'recaptcha_challenge_field') || '';
my $response = $ParamObject->GetParam(Param => 'recaptcha_response_field') || '';
my $result = $rc->check_answer(" ****PRIVATE KEY**** ", $ENV{'REMOTE_ADDR'}, # private key
$challenge, $response
);
if ( !$result->{is_valid} ) {
my $Output = $LayoutObject->CustomerHeader(
Area => 'Core',
Title => 'Error'
);
$Output .= $LayoutObject->CustomerWarning(
Message => 'reCAPTCHA entry failed.',
Comment => 'Please press Back and try again.'
);
$Output .= $LayoutObject->CustomerFooter();
$LayoutObject->Print( Output => \$Output );
exit 0;
}
#end recaptcha
# get new password
$GetParams{UserPassword} = $UserObject->GenerateRandomPassword();
Search for "[% RenderBlockStart("CreateAccount") %]"
Scroll a bit down around line 135 you should add the recaptcha block like below
Code: Select all
<div class="NewLine">
<label class="Mandatory" for="Email"><span class="Marker">*</span> [% Translate("Email") | html %]</label>
<input title="[% Translate("Your email address (this will become your username)") | html %]" name="Email" type="[% Env("EmailFieldType") | html %]" id="Email" maxlength="150" value="[% Data.UserEmail | html %]" class="W100pc Validate_Required Validate_Email"/>
<div id="EmailError" class="TooltipErrorMessage"><p>[% Translate("This field is required.") | html %]</p></div>
</div>
<!-- begin recaptcha -->
<div class="NewLine">
[% Data.reCAPTCHA %]
</div>
<!-- end recaptcha -->
<div class="NewLine">
<button id="CreateAccount" type="submit" value="[% Translate("Create") | html %]" disabled="disabled">[% Translate("Create") | html %]</button>
</div>
<div class="Clear"></div>
</form>
</div>
edit file: /opt/otrs/var/httpd/htdocs/skins/Customer/default/css/Core.Login.css
Search for "#Slider {" and change height from 260 to 400
and search for "#PreLogin {" and change height from 260 to 400
example below (I commented out the old lines just as example):
Code: Select all
/**
* @subsection Slider
*/
#Slider {
margin-bottom: 34px;
width: 642px;
/* height: 260px; */
height: 400px;
overflow: hidden;
}
#Slider h2 {
line-height: 22px;
}
#Login,
#Reset,
#Signup,
#PreLogin {
width: 500px;
/* height: 260px; */
height: 400px;
padding-left: 142px;
position: relative;
}