- Hours the counter reading cannot parse (",5") no longer fail after
they are saved; they just get no hour counter suggestion.
- The console's sign-in falls back to a console machine list
(machines::console-picker at /console/machines) instead of /machines,
so it stays in the console's own session.
- Recording counter usage locks the counter first, so usage saved at
the same time from two devices is not lost.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
82 lines
3.3 KiB
PHP
82 lines
3.3 KiB
PHP
<?php
|
|
|
|
use App\Modules\Users\Application\UseCases\CheckLoginAllowed;
|
|
use App\Modules\Users\Application\UseCases\LoginPins;
|
|
use App\Modules\Users\Presentation\Livewire\Concerns\SignsInWithPassword;
|
|
use App\Modules\Users\Presentation\Livewire\Concerns\SignsInWithPin;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Component;
|
|
|
|
/**
|
|
* Signing in to the machine console's own session (spec 19.6), e.g. on a
|
|
* tablet next to the machine: with the user's own PIN code or with email
|
|
* and password. Returns to the console page that asked for it.
|
|
*/
|
|
new #[Layout('layouts.console')] class extends Component
|
|
{
|
|
use SignsInWithPassword;
|
|
use SignsInWithPin;
|
|
|
|
public bool $accessEnded = false;
|
|
|
|
public function mount(): void
|
|
{
|
|
$this->accessEnded = request()->query('access') === 'ended';
|
|
}
|
|
|
|
public function loginWithPin(LoginPins $pins): void
|
|
{
|
|
if ($this->signInWithPin($pins)) {
|
|
$this->redirectIntended(route('machines.console-picker'));
|
|
}
|
|
}
|
|
|
|
public function loginWithPassword(CheckLoginAllowed $checkLoginAllowed): void
|
|
{
|
|
$this->signInWithPassword($checkLoginAllowed);
|
|
|
|
$this->redirectIntended(route('machines.console-picker'));
|
|
}
|
|
|
|
public function render(): mixed
|
|
{
|
|
return $this->view()->title(__('users.console_login.title'));
|
|
}
|
|
};
|
|
?>
|
|
|
|
<div class="mx-auto max-w-3xl space-y-6 p-3 sm:p-6">
|
|
<h1 class="text-2xl font-semibold">{{ __('users.console_login.title') }}</h1>
|
|
|
|
<p>{{ __('users.console_login.intro') }}</p>
|
|
|
|
@if ($accessEnded)
|
|
<x-alert role="status" color="yellow" light icon="exclamation-triangle" :text="__('auth.account_disabled')" />
|
|
@elseif (session('status'))
|
|
<x-alert role="status" color="green" light icon="information-circle" :text="session('status')" />
|
|
@endif
|
|
|
|
<div class="grid gap-6 md:grid-cols-2">
|
|
<section aria-labelledby="console-login-pin" class="space-y-4 rounded-lg border border-zinc-300 p-4 dark:border-zinc-600">
|
|
<h2 id="console-login-pin" class="text-xl font-semibold">{{ __('users.console_login.with_pin') }}</h2>
|
|
@if ($this->pinUsers === [])
|
|
<p>{{ __('users.pin_switch.no_users') }}</p>
|
|
@else
|
|
<form wire:submit="loginWithPin" class="space-y-4" novalidate>
|
|
<x-users.pin-fields :users="$this->pinUsers" />
|
|
<x-button submit icon="arrow-right-end-on-rectangle" :text="__('users.pin_switch.submit')" class="w-full" />
|
|
</form>
|
|
@endif
|
|
</section>
|
|
|
|
<section aria-labelledby="console-login-password" class="space-y-4 rounded-lg border border-zinc-300 p-4 dark:border-zinc-600">
|
|
<h2 id="console-login-password" class="text-xl font-semibold">{{ __('users.console_login.with_password') }}</h2>
|
|
<form wire:submit="loginWithPassword" class="space-y-4" novalidate>
|
|
<x-input id="console-login-email" wire:model="email" type="email" :label="__('auth.email')" autocomplete="username" required />
|
|
<x-password-field id="console-login-password-field" wire:model="password" :label="__('auth.password_label')" autocomplete="current-password" required />
|
|
<x-button submit :text="__('auth.login')" class="w-full" />
|
|
</form>
|
|
</section>
|
|
</div>
|
|
</div>
|