Parcourir la source

Make registration limit an env var

merge-requests/1/head
Vincent Canfield il y a 4 ans
Parent
révision
254f02f483
2 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 2
    0
      .env.example
  2. 1
    1
      app/Services/Registrar.php

+ 2
- 0
.env.example Voir le fichier

@@ -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 Voir le fichier

@@ -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, [

Chargement…
Annuler
Enregistrer