reCaptcha for Gesior ACC (Accountmanagement)
This is very usefull against people trying to steal accounts using bots.
First of all, you need an API key then register a domain(s)... Also you need an Google Account.
Here: https://www.google.com/recaptcha/admin
We will need the Public and Private Key which are in your admin panel.
Then we go to layouts and in layout.php we'll add this before </head>
Next step is add the reCaptcha to your Accountmanagement so we go to accountmagement.php
Under <?php add this
Now we have to find this:
Next to the previous line add this:
Note: You have to add your Public Key there ^
Note2: Also you can change the theme color to black adding this to div data-theme="dark"
Now we go to system/load.login.php and under <?php add this
Find:
And replace it with:
Note: You have to add your Private Key there ^
That's all, now we have a fully working reCaptcha in our Accountmanagement.
You can see a demo here:
http://marlboro-war.servegame.com/?subtopic=accountmanagement
This is very usefull against people trying to steal accounts using bots.
First of all, you need an API key then register a domain(s)... Also you need an Google Account.
Here: https://www.google.com/recaptcha/admin
We will need the Public and Private Key which are in your admin panel.
Then we go to layouts and in layout.php we'll add this before </head>
Code:
<script src='https://www.google.com/recaptcha/api.js'></script>
Next step is add the reCaptcha to your Accountmanagement so we go to accountmagement.php
Under <?php add this
Code:
if(isset($_REQUEST['account_login']) && isset($_REQUEST['password_login']) && !$captcha)
{
$main_content .='<h2>Please check the reCaptcha form.</h2>';
}
Now we have to find this:
Code:
<input type="password" name="password_login" size="15" maxlength="15">
Next to the previous line add this:
Code:
<div class="g-recaptcha" data-sitekey="YOUR_PUBLIC_KEY_HERE"></div>
Note2: Also you can change the theme color to black adding this to div data-theme="dark"
Now we go to system/load.login.php and under <?php add this
Code:
if(isset($_POST['g-recaptcha-response']))
{
$captcha=$_POST['g-recaptcha-response'];
}
Find:
Code:
if(isset($_REQUEST['account_login']) && isset($_REQUEST['password_login']))
{
Visitor::setAccount($_REQUEST['account_login']);
Visitor::setPassword($_REQUEST['password_login']);
//Visitor::login(); // this set account and password from code above as login and password to next login attempt
//Visitor::loadAccount(); // this is required to force reload account and get status of user
$isTryingToLogin = true;
}
And replace it with:
Code:
if(isset($_REQUEST['account_login']) && isset($_REQUEST['password_login']) && $captcha)
{
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=YOUR_PRIVATE_KEY_HERE&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
if($response.success==false)
{
echo '<h2>Dirty Robot!</h2>';
}
else
{
Visitor::setAccount($_REQUEST['account_login']);
Visitor::setPassword($_REQUEST['password_login']);
//Visitor::login(); // this set account and password from code above as login and password to next login attempt
//Visitor::loadAccount(); // this is required to force reload account and get status of user
$isTryingToLogin = true;
}
}
That's all, now we have a fully working reCaptcha in our Accountmanagement.
You can see a demo here:
http://marlboro-war.servegame.com/?subtopic=accountmanagement
Last edited: