mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-16 12:33:03 +00:00
rate limit things
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use DanHarrin\LivewireRateLimiting\WithRateLimiting;
|
||||
use Livewire\Component;
|
||||
|
||||
class ForcePasswordReset extends Component
|
||||
{
|
||||
use WithRateLimiting;
|
||||
public string $email;
|
||||
public string $password;
|
||||
public string $password_confirmation;
|
||||
@@ -21,6 +23,7 @@ class ForcePasswordReset extends Component
|
||||
}
|
||||
public function submit() {
|
||||
try {
|
||||
$this->rateLimit(10);
|
||||
$this->validate();
|
||||
auth()->user()->forceFill([
|
||||
'password' => Hash::make($this->password),
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Jobs\SendConfirmationForWaitlistJob;
|
||||
use App\Models\User;
|
||||
use App\Models\Waitlist as ModelsWaitlist;
|
||||
use Livewire\Component;
|
||||
|
||||
@@ -24,6 +25,11 @@ class Waitlist extends Component
|
||||
{
|
||||
$this->validate();
|
||||
try {
|
||||
$already_registered = User::whereEmail($this->email)->first();
|
||||
if ($already_registered) {
|
||||
$this->emit('success', 'You are already registered (Thank you 💜).');
|
||||
return;
|
||||
}
|
||||
$found = ModelsWaitlist::where('email', $this->email)->first();
|
||||
ray($found);
|
||||
if ($found) {
|
||||
|
||||
@@ -98,6 +98,14 @@ class FortifyServiceProvider extends ServiceProvider
|
||||
return view('auth.two-factor-challenge');
|
||||
});
|
||||
|
||||
RateLimiter::for('force-password-reset', function (Request $request) {
|
||||
return Limit::perMinute(15)->by($request->user()->id);
|
||||
});
|
||||
|
||||
RateLimiter::for('forgot-password', function (Request $request) {
|
||||
return Limit::perMinute(5)->by($request->ip());
|
||||
});
|
||||
|
||||
RateLimiter::for('login', function (Request $request) {
|
||||
$email = (string)$request->email;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user