ip(); $globalKey = 'system-password'; // Count before the slow hash check, so parallel requests cannot all pass a read-only check. $ipHits = RateLimiter::hit($ipKey, 60); $globalHits = RateLimiter::hit($globalKey, 60); if ($ipHits > 5 || $globalHits > 20) { $seconds = max( $ipHits > 5 ? RateLimiter::availableIn($ipKey) : 0, $globalHits > 20 ? RateLimiter::availableIn($globalKey) : 0, ); $this->addError('password', __('Too many attempts. Please try again in :seconds seconds.', ['seconds' => $seconds])); return; } $this->validate(); $systemPassword = Setting::get('system_password'); if (! $systemPassword || ! Hash::check($this->password, $systemPassword)) { $this->addError('password', __('The password is incorrect.')); return; } RateLimiter::clear($ipKey); RateLimiter::clear($globalKey); session(['system_password_verified' => hash('sha256', $systemPassword)]); $this->redirect(route('upload'), navigate: true); } public function render(): mixed { return view('livewire.system-password-prompt'); } }