authorize('machines.use'); } public function save(LoginPins $pins): void { $this->authorize('machines.use'); $this->resetErrorBag(); if (trim($this->pin) !== trim($this->pinConfirmation)) { $this->addError('pinConfirmation', __('users.pin.errors.confirmation')); return; } try { $pins->set((int) auth()->id(), $this->currentPassword, $this->pin); } catch (InvalidLoginPin) { $this->addError('pin', __('users.pin.errors.pin')); return; } catch (WrongPassword) { $this->addError('currentPassword', __('users.pin.errors.password')); return; } $this->reset('currentPassword', 'pin', 'pinConfirmation'); $this->message = __('users.pin.saved'); } public function remove(LoginPins $pins): void { $this->authorize('machines.use'); $this->resetErrorBag(); try { $pins->remove((int) auth()->id(), $this->currentPassword); } catch (WrongPassword) { $this->addError('currentPassword', __('users.pin.errors.password')); return; } $this->reset('currentPassword', 'pin', 'pinConfirmation'); $this->message = __('users.pin.removed'); } public function render(): mixed { return $this->view()->title(__('users.pin.title')); } }; ?>
{{ __('users.pin.intro') }}
{{ $message !== '' ? $message : (app(LoginPins::class)->has((int) auth()->id()) ? __('users.pin.is_set') : __('users.pin.not_set')) }}