Files
Toiminnanohjaus/app/Modules/Users/Presentation/Livewire/⚡forgot-password.blade.php
T
petriandClaude Opus 5.5 c9a7f970ab Fix review findings in login and user management
- Load stored users without re-checking role rules, so an intern whose
  supervisor was deleted no longer gets a 500 on every request; the
  rules apply again on the next change.
- Refuse to deactivate or demote a supervisor of active interns
  (SupervisorHasInterns).
- Lock active admin rows in the last-admin check so concurrent changes
  cannot remove every admin.
- Creating a user survives mail failures: the error is reported and
  the admin is asked to resend the link (CreatedUserAccount result).
- Session-ended redirect passes the reason in the URL
  (/login?access=ended), so Livewire requests also show it.
- Same login message for a wrong password and a disabled account.
- Forgot-password sends links only to users who may sign in today
  (RequestPasswordReset), with the same neutral message.
- Use the default callout instead of the low-contrast warning variant.
- Document make:class/make:test for module files in CLAUDE.md.

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

58 lines
1.9 KiB
PHP

<?php
use App\Modules\Users\Application\UseCases\RequestPasswordReset;
use App\Modules\Users\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">
<flux:heading size="xl" level="1">{{ __('auth.forgot_title') }}</flux:heading>
<div role="status" aria-live="polite">
@if ($linkRequested)
<flux:callout variant="success" icon="envelope" :heading="__('auth.forgot_sent')" />
@endif
</div>
<flux:text>{{ __('auth.forgot_intro') }}</flux:text>
<form wire:submit="sendLink" class="space-y-6" novalidate>
<flux:input wire:model="email" type="email" :label="__('auth.email')" autocomplete="username" required />
<div class="flex flex-wrap items-center justify-between gap-4">
<flux:button type="submit" variant="primary">{{ __('auth.forgot_submit') }}</flux:button>
<flux:link :href="route('login')" wire:navigate>{{ __('auth.back_to_login') }}</flux:link>
</div>
</form>
</div>