Files
Toiminnanohjaus/app/Modules/Users/Presentation/Livewire/⚡forgot-password.blade.php
T
petriandClaude Opus 5.5 e0b8f4970f Add customer contacts, billing units and consumer personal identity codes
Customer page and contacts/billing units (phase 1, item 2):
- New customer page (customers.show) with details, contacts and billing
  units; add and edit on their own pages, delete after confirmation.
  Creating or editing a customer now leads to this page.
- Contacts: name, title, phone, email, note. Billing units: name,
  billing address, e-invoice address (12-35 letters/digits), operator
  (required with an e-invoice address) and reference.
- Use cases check that the row belongs to the customer, so ids in the
  URL can't reach another customer's rows.
- EmailAddress moves from Users to Shared so both modules can use it.
- <x-confirm-dialog> (native <dialog>) replaces <x-modal>, whose title,
  close button and focus handling are not accessible; solid red buttons
  use red-700 via published NormalButtonColors for 4.5:1 contrast.

Personal identity code (henkilötunnus) for consumers who are invoiced:
- Validated (date, century sign, check character), stored encrypted
  with an HMAC blind index for duplicate checks; never in
  CustomerSummary, search, logs or Livewire state.
- Admins and management see it in full and may remove it; others enter
  it and see only the masked form. The form never shows the stored code.

Spec, architecture doc and CLAUDE.md updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 18:11:06 +02:00

58 lines
1.8 KiB
PHP

<?php
use App\Modules\Users\Application\UseCases\RequestPasswordReset;
use App\Modules\Shared\Domain\ValueObjects\EmailAddress;
use Livewire\Component;
new class extends Component
{
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')],
);
$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">
<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="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>