Files
Toiminnanohjaus/app/Modules/Users/Presentation/Livewire/⚡reset-password.blade.php
T
petriandClaude Opus 5.5 90d6f5bd66 Replace Flux UI with TallStackUI 4
Rewrite the layout and all Customers and Users pages with TallStackUI
components and remove livewire/flux and its Boost skill.

Fix the TallStackUI accessibility gaps found by the axe tests:
- password reveal and theme switch have no accessible name: add
  <x-password-field> and keep the own theme toggle button
- select.native label is not tied to the control: add aria-label
- contrast: darker primary palette, soft-customized error colours and
  published alert/link colour classes; neutral buttons use subtle black
- follow the system theme by default (localStorage key dark-theme)

Load TallStackUI assets from the app URL so they work in the XAMPP
subfolder, add Finnish TallStackUI strings, and drop inputmode=numeric
from the business ID field so iOS keyboards show the hyphen.

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

102 lines
3.0 KiB
PHP

<?php
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules\Password as PasswordRule;
use Livewire\Attributes\Locked;
use Livewire\Component;
new class extends Component
{
#[Locked]
public string $token = '';
public string $email = '';
public string $password = '';
public string $password_confirmation = '';
public function mount(string $token): void
{
$this->token = $token;
$this->email = (string) request()->query('email', '');
}
public function resetPassword(): void
{
$this->validate(
[
'email' => ['required', 'string', 'email'],
'password' => ['required', 'string', 'confirmed', PasswordRule::defaults()],
],
[
'email.required' => __('auth.email_required'),
'email.email' => __('auth.email_invalid'),
'password.required' => __('auth.password_required'),
'password.confirmed' => __('auth.password_mismatch'),
'password.min' => __('auth.password_too_short', ['min' => 12]),
],
);
$status = Password::reset(
[
'email' => Str::lower(trim($this->email)),
'password' => $this->password,
'password_confirmation' => $this->password_confirmation,
'token' => $this->token,
],
function ($user, string $password): void {
$user->forceFill(['password' => $password, 'remember_token' => Str::random(60)])->save();
event(new PasswordReset($user));
},
);
if ($status !== Password::PASSWORD_RESET) {
$this->reset('password', 'password_confirmation');
$this->addError('email', __($status));
return;
}
session()->flash('status', __($status));
$this->redirectRoute('login');
}
public function render(): mixed
{
return $this->view()->title(__('auth.reset_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.reset_title') }}</h1>
<p class="text-sm text-zinc-600 dark:text-zinc-300">{{ __('auth.reset_intro') }}</p>
<form wire:submit="resetPassword" class="space-y-6" novalidate>
<x-input wire:model="email" type="email" :label="__('auth.email')" autocomplete="username" required />
<x-password-field
wire:model="password"
:label="__('auth.new_password')"
:hint="__('auth.password_rules')"
autocomplete="new-password"
required
/>
<x-password-field
wire:model="password_confirmation"
:label="__('auth.confirm_password')"
autocomplete="new-password"
required
/>
<x-button submit :text="__('auth.reset_submit')" />
</form>
</div>