84 lines
3.3 KiB
PHP
84 lines
3.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Validation\ValidationException;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Volt\Component;
|
|
|
|
new #[Layout('layouts.guest')] class extends Component
|
|
{
|
|
public string $password = '';
|
|
|
|
public function confirmPassword(): void
|
|
{
|
|
$this->validate([
|
|
'password' => ['required', 'string'],
|
|
]);
|
|
|
|
if (! Auth::guard('web')->validate([
|
|
'email' => Auth::user()->email,
|
|
'password' => $this->password,
|
|
])) {
|
|
throw ValidationException::withMessages([
|
|
'password' => __('auth.password'),
|
|
]);
|
|
}
|
|
|
|
session(['auth.password_confirmed_at' => time()]);
|
|
$this->redirectIntended(default: route('dashboard', absolute: false), navigate: true);
|
|
}
|
|
}; ?>
|
|
|
|
<div>
|
|
<div class="mb-6">
|
|
<h1 class="text-2xl font-bold tracking-tight text-text-primary">Sicherheitsbereich</h1>
|
|
<p class="text-sm text-text-muted mt-1">
|
|
Bitte bestätige dein Passwort, um fortzufahren.
|
|
</p>
|
|
</div>
|
|
|
|
<form wire:submit="confirmPassword" class="space-y-4">
|
|
|
|
<div>
|
|
<x-input-label for="password" value="Aktuelles Passwort" />
|
|
<div class="relative" x-data="{ showPassword: false }">
|
|
<x-text-input
|
|
wire:model="password"
|
|
id="password"
|
|
type="password"
|
|
x-bind:type="showPassword ? 'text' : 'password'"
|
|
name="password"
|
|
required
|
|
autocomplete="current-password"
|
|
class="pr-10"
|
|
/>
|
|
<button type="button" @click="showPassword = !showPassword"
|
|
class="absolute right-3 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-secondary transition-colors duration-150 cursor-pointer"
|
|
aria-label="Passwort anzeigen">
|
|
<span x-show="!showPassword">
|
|
<x-heroicon-o-eye class="w-4 h-4" />
|
|
</span>
|
|
<span x-show="showPassword" x-cloak>
|
|
<x-heroicon-o-eye-slash class="w-4 h-4" />
|
|
</span>
|
|
</button>
|
|
</div>
|
|
<x-input-error :messages="$errors->get('password')" />
|
|
</div>
|
|
|
|
<x-primary-button class="w-full relative" style="position:relative;" wire:loading.attr="disabled">
|
|
<span wire:loading.class="opacity-50" wire:target="confirmPassword" class="flex items-center gap-2 transition-opacity">
|
|
<x-heroicon-o-shield-check class="w-4 h-4" />
|
|
Bestätigen
|
|
</span>
|
|
<span wire:loading.flex wire:target="confirmPassword" style="position:absolute;top:0;right:0;bottom:0;left:0;align-items:center;justify-content:center;">
|
|
<svg class="animate-spin w-4 h-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path>
|
|
</svg>
|
|
</span>
|
|
</x-primary-button>
|
|
|
|
</form>
|
|
</div>
|