Files
Toiminnanohjaus/app/Modules/Users/Presentation/Livewire/⚡forgot-password.blade.php
T
petriandClaude Opus 5.5 51b40b24fe Give the UI an indigo look with cards, status badges and empty states
- Dark indigo header and tinted page background; the mobile main menu gets
  its own row, in the same order as the keyboard reaches it.
- Page titles with an icon chip (x-page-title, x-page, x-page-header) and
  card sections (x-panel, the card utility); x-table styled as a card with
  an indigo header row in AppServiceProvider::styleTables().
- Job and task statuses, late work, unapproved hours and stock states as
  badges with icon and text (x-status-badge, x-jobs.status,
  x-jobs.task-status), never colour alone.
- Empty lists as x-empty-state; dashboard quick link tiles, week hour bars
  and trend arrows; Kanban columns and task cards edged by status; calendar
  today column and bar accents; quick sale, reports and machine console
  restyled; signed-out pages show the app name.
- Focus rings use the primary colour in both themes (white in the header).
- Document the components in CLAUDE.md; test the status badges.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-29 10:53:10 +02:00

74 lines
2.5 KiB
PHP

<?php
use App\Modules\Users\Application\UseCases\RequestPasswordReset;
use App\Modules\Shared\Domain\ValueObjects\EmailAddress;
use Illuminate\Support\Facades\RateLimiter;
use Livewire\Component;
new class extends Component
{
public const int MAX_REQUESTS_PER_IP_PER_MINUTE = 5;
public string $email = '';
public bool $linkRequested = false;
/**
* Shows the same message whether or not the address has a usable
* account, so the page cannot be used to find out which addresses exist.
*/
public function sendLink(RequestPasswordReset $requestPasswordReset): void
{
$this->email = trim($this->email);
$this->validate(
['email' => ['required', 'string', 'email:filter', 'max:255']],
['email.required' => __('auth.email_required'), 'email.email' => __('auth.email_invalid'), 'email.max' => __('auth.email_invalid')],
);
// Laravel allows one link a minute per account; this also limits one
// address asking links for many accounts (mail flooding).
$throttleKey = 'forgot-password|'.request()->ip();
if (RateLimiter::tooManyAttempts($throttleKey, self::MAX_REQUESTS_PER_IP_PER_MINUTE)) {
$this->addError('email', __('auth.forgot_throttle', ['seconds' => RateLimiter::availableIn($throttleKey)]));
return;
}
RateLimiter::hit($throttleKey);
$requestPasswordReset->execute(new EmailAddress($this->email));
$this->linkRequested = true;
}
public function render(): mixed
{
return $this->view()->title(__('auth.forgot_title'));
}
};
?>
<div class="mx-auto max-w-md space-y-6 p-4 sm:p-6 sm:pt-16">
@include('partials.guest-brand')
<h1 class=\"text-2xl font-semibold\">{{ __('auth.forgot_title') }}</h1>
<div role="status" aria-live="polite">
@if ($linkRequested)
<x-alert color="green" light icon="envelope" :text="__('auth.forgot_sent')" />
@endif
</div>
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('auth.forgot_intro') }}</p>
<form wire:submit="sendLink" class="card space-y-6" novalidate>
<x-input wire:model="email" type="email" :label="__('auth.email')" autocomplete="username" required />
<div class="flex flex-wrap items-center justify-between gap-4">
<x-button submit :text="__('auth.forgot_submit')" />
<x-link :href="route('login')" navigate :text="__('auth.back_to_login')" />
</div>
</form>
</div>