浏览代码

Make registration limit an env var

merge-requests/1/head
Vincent Canfield 4 年前
父节点
当前提交
254f02f483
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 2
    0
      .env.example
  2. 1
    1
      app/Services/Registrar.php

+ 2
- 0
.env.example 查看文件

@@ -24,3 +24,5 @@ D_EXPENSES=1.0
L_BALANCE=0.0
L_DONATIONS=0.0
L_EXPENSES=1.0

REGISTRATION_LIMIT=5

+ 1
- 1
app/Services/Registrar.php 查看文件

@@ -18,7 +18,7 @@ class Registrar implements RegistrarContract {
Validator::extend('floodprotection', function ($attribute, $value, $parameters)
{
$time = Carbon::now()->subDay();
return User::where('registered_ip',$_SERVER['REMOTE_ADDR'])->where('created_at','>=',$time)->count() < 5;
return User::where('registered_ip',$_SERVER['REMOTE_ADDR'])->where('created_at','>=',$time)->count() < env('REGISTRATION_LIMIT',5);
});

return Validator::make($data, [

正在加载...
取消
保存