Files
petriandClaude Opus 5.5 f4b58f6b1d Darken the dark canvas, add customer colours, the ongoing status and the board model
- Dark theme page background is #5a5e60; text on it is lifted to zinc-200 /
  primary-100 and TallStackUI's dark labels, hints and checkbox labels are
  lightened so everything stays at 4.5:1.
- Shared HexColor picks white or black text by the higher WCAG contrast; a
  native-dialog colour picker and a large work dialog component.
- Customers get a header colour (customers.header_color), set on the
  customer page.
- New job status Jatkuvat / Kausi (ongoing): open, never late, billed
  monthly like running jobs.
- Kanban model: board columns and views, urgent threshold, per-user board
  preferences (density, column colours and sort), card positions, tasks of
  continuing jobs pinned to the board, MoveBoardCard and board queries with
  logged hours from TimeTracking.

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

124 lines
3.9 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
{
/**
* Password brokers in config/auth.php: forgot-password links, then links
* made by an admin.
*/
private const array BROKERS = ['users', 'admin_links'];
#[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]),
'password.password.mixed' => __('auth.password_needs_mixed_case'),
'password.password.numbers' => __('auth.password_needs_number'),
'password.password.symbols' => __('auth.password_needs_symbol'),
],
);
$credentials = [
'email' => Str::lower(trim($this->email)),
'password' => $this->password,
'password_confirmation' => $this->password_confirmation,
'token' => $this->token,
];
// A forgot-password link (60 min) or a link made by an admin (72 h);
// each kind has its own broker. Using a link ends every other link.
foreach (self::BROKERS as $broker) {
$status = Password::broker($broker)->reset($credentials, function ($user, string $password): void {
foreach (self::BROKERS as $anyBroker) {
Password::broker($anyBroker)->deleteToken($user);
}
$user->forceFill(['password' => $password, 'remember_token' => Str::random(60)])->save();
event(new PasswordReset($user));
});
if ($status !== Password::INVALID_TOKEN) {
break;
}
}
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">
@include('partials.guest-brand')
<h1 class=\"text-2xl font-semibold\">{{ __('auth.reset_title') }}</h1>
<p class="text-sm text-zinc-600 dark:text-zinc-200">{{ __('auth.reset_intro') }}</p>
<form wire:submit="resetPassword" class="card 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>