mirror of
https://github.com/slawkens/myaac.git
synced 2026-02-06 21:26:22 +01:00
New Setting: block create account spam by ip
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
use MyAAC\CreateCharacter;
|
||||
use MyAAC\Models\AccountAction;
|
||||
use MyAAC\Models\AccountEmailVerify;
|
||||
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
@@ -44,6 +45,16 @@ $errors = array();
|
||||
$save = isset($_POST['save']) && $_POST['save'] == 1;
|
||||
if($save)
|
||||
{
|
||||
$cooldown = setting('core.account_create_ip_block_cooldown');;
|
||||
if ($cooldown > 0) {
|
||||
$accountAction = AccountAction::where('ip', get_browser_real_ip())->where('action', 'Account created.')->where('date', '>=', time() - ($cooldown * 60))->first();
|
||||
|
||||
if ($accountAction) {
|
||||
$minute = ($cooldown > 1 ? 'minutes' : 'minute');
|
||||
$errors['account'] = "You have to wait $cooldown $minute before creating another account.";
|
||||
}
|
||||
}
|
||||
|
||||
if(!config('account_login_by_email')) {
|
||||
if(USE_ACCOUNT_NAME) {
|
||||
$account_name = $_POST['account'];
|
||||
|
||||
@@ -1744,6 +1744,18 @@ Sent by MyAAC,<br/>
|
||||
'account_login_ipban_protection', '=', 'true'
|
||||
]
|
||||
],
|
||||
|
||||
[
|
||||
'type' => 'section',
|
||||
'title' => 'Cooldowns',
|
||||
],
|
||||
'account_create_ip_block_cooldown' => [
|
||||
'name' => 'Create Account IP Block Cooldown',
|
||||
'type' => 'number',
|
||||
'desc' => 'Block flooding create account per ip. If you still have a problem with account create spam - then its recommended to install the recaptcha plugin.' .
|
||||
'<br/><strong>In minutes.</strong> 0 to disable.',
|
||||
'default' => 10,
|
||||
],
|
||||
],
|
||||
'callbacks' => [
|
||||
'beforeSave' => function(&$settings, &$values) {
|
||||
|
||||
Reference in New Issue
Block a user