The console under console/ has its own session cookie and console guard (UseConsoleSession), so signing out or changing user there leaves the normal interface alone. Links open it in a new window through a one-time handoff key; a signed-out console asks for a PIN code or password on its own login page. Users set their 4-6 digit PIN on the profile's PIN page, and the console's change user dialog takes it on a keypad; five wrong PINs lock PIN sign-in for 15 minutes. Machine counters are cumulative: users record how much a job used and it is added to the latest reading. A maintenance record restarts the whole counter interval from the reading at the record. 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.index'));
|
|
}
|
|
}
|
|
|
|
public function loginWithPassword(CheckLoginAllowed $checkLoginAllowed): void
|
|
{
|
|
$this->signInWithPassword($checkLoginAllowed);
|
|
|
|
$this->redirectIntended(route('machines.index'));
|
|
}
|
|
|
|
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>
|