Restliche Phase 4 aus dem Sicherheitsaudit 07.10.2026: - Sicherheitsseite: „Andere Geräte abmelden“ rotiert remember_token und beendet alle anderen Sessions, die aktuelle bleibt (nicht während einer Impersonation). - LoginIpThrottle: 20 Fehlversuche je IP in 15 Minuten über alle Konten. Gezählt über das Failed-Event, damit Livewire-Login und Fortifys POST /login denselben Zähler teilen; Erfolg setzt ihn nicht zurück. - Sperrmarke für Sessions in users.sessions_revoked_at_ms statt nur im Cache — übersteht cache:clear. Die alte Cache-Marke zählt übergangsweise mit und kann im nächsten Release entfallen. - Neue und geänderte Passwörter: mindestens 12 Zeichen, in Produktion zusätzlich uncompromised() (HIBP, k-Anonymität). Bestehende bleiben gültig. - Content-Security-Policy-Report-Only in Produktion; Meldungen über /csp-report nach storage/logs/csp-*.log, je Meldung höchstens einmal pro Stunde, ohne Query und tokenartige Pfadsegmente. Migration: users.sessions_revoked_at_ms (users hat FULLTEXT, 25 MB, Sekunden). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
113 lines
3.7 KiB
PHP
113 lines
3.7 KiB
PHP
<?php
|
|
|
|
use Illuminate\Auth\Events\PasswordReset;
|
|
use Illuminate\Support\Facades\Hash;
|
|
use Illuminate\Support\Facades\Password;
|
|
use Illuminate\Support\Facades\Session;
|
|
use Illuminate\Support\Str;
|
|
use Illuminate\Validation\Rules;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Attributes\Locked;
|
|
use Livewire\Component;
|
|
|
|
new #[Layout('components.layouts.auth.pressekonto', ['heading' => 'Neues Passwort vergeben', 'eyebrow' => 'Passwort zurücksetzen'])] class extends Component {
|
|
#[Locked]
|
|
public string $token = '';
|
|
|
|
public string $email = '';
|
|
|
|
public string $password = '';
|
|
|
|
public string $password_confirmation = '';
|
|
|
|
/**
|
|
* Mount the component.
|
|
*/
|
|
public function mount(string $token): void
|
|
{
|
|
$this->token = $token;
|
|
|
|
$this->email = request()->string('email');
|
|
}
|
|
|
|
/**
|
|
* Reset the password for the given user.
|
|
*/
|
|
public function resetPassword(): void
|
|
{
|
|
$this->validate([
|
|
'token' => ['required'],
|
|
'email' => ['required', 'string', 'email'],
|
|
'password' => ['required', 'string', 'confirmed', Rules\Password::defaults()],
|
|
]);
|
|
|
|
$status = Password::reset(
|
|
$this->only('email', 'password', 'password_confirmation', 'token'),
|
|
function ($user) {
|
|
$user->forceFill([
|
|
'password' => Hash::make($this->password),
|
|
'remember_token' => Str::random(60),
|
|
])->save();
|
|
|
|
event(new PasswordReset($user));
|
|
}
|
|
);
|
|
|
|
if ($status != Password::PasswordReset) {
|
|
$this->addError('email', __($status));
|
|
|
|
return;
|
|
}
|
|
|
|
// Alle offenen Sessions sind beendet (RevokeAccessAfterPasswordReset);
|
|
// API-Tokens bleiben bewusst gültig (Sicherheitsaudit 07.10.2026, S-04).
|
|
Session::flash('status', __('Ihr Passwort wurde zurückgesetzt. Alle angemeldeten Geräte wurden abgemeldet. Bitte prüfen Sie nach der Anmeldung unter „Sicherheit“ auch Ihre API-Tokens.'));
|
|
|
|
$this->redirectRoute('login', navigate: true);
|
|
}
|
|
}; ?>
|
|
|
|
<div>
|
|
<p class="text-[13.5px] text-ink-2 leading-[1.6] !-mt-4 mb-6">
|
|
{{ __('Vergeben Sie ein neues Passwort für Ihr Konto. Mindestens 12 Zeichen — am einfachsten eine Folge mehrerer Wörter.') }}
|
|
</p>
|
|
|
|
<form wire:submit="resetPassword" class="space-y-[18px]" novalidate>
|
|
|
|
<div>
|
|
<label class="field-label" for="auth-email">{{ __('E-Mail-Adresse') }}</label>
|
|
<input
|
|
id="auth-email"
|
|
type="email"
|
|
wire:model="email"
|
|
required
|
|
autocomplete="email"
|
|
class="field-input"
|
|
@error('email') aria-invalid="true" @enderror
|
|
/>
|
|
@error('email')
|
|
<p class="field-error">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<x-password-input
|
|
name="password"
|
|
:label="__('Neues Passwort')"
|
|
autocomplete="new-password"
|
|
:placeholder="__('Mindestens 12 Zeichen')"
|
|
/>
|
|
|
|
<x-password-input
|
|
name="password_confirmation"
|
|
:label="__('Passwort bestätigen')"
|
|
autocomplete="new-password"
|
|
:placeholder="__('Neues Passwort wiederholen')"
|
|
:show-error="false"
|
|
/>
|
|
|
|
<button type="submit" class="auth-btn-primary !mt-[22px]" wire:loading.attr="disabled" wire:target="resetPassword">
|
|
<span wire:loading.remove wire:target="resetPassword">{{ __('Passwort zurücksetzen') }}</span>
|
|
<span wire:loading wire:target="resetPassword">{{ __('Passwort wird gespeichert …') }}</span>
|
|
</button>
|
|
</form>
|
|
</div>
|