From eabd56210a86f962a85283c4188e386a94e562c6 Mon Sep 17 00:00:00 2001 From: iglocska Date: Fri, 7 Jun 2024 14:04:24 +0200 Subject: [PATCH] fix: [authkeys] allow for authkeys with no expiration set, fixes #169 --- src/Controller/AuthKeysController.php | 3 +++ templates/AuthKeys/add.php | 1 + 2 files changed, 4 insertions(+) diff --git a/src/Controller/AuthKeysController.php b/src/Controller/AuthKeysController.php index 37aa356..7bca8d5 100644 --- a/src/Controller/AuthKeysController.php +++ b/src/Controller/AuthKeysController.php @@ -90,6 +90,9 @@ class AuthKeysController extends AppController if (!in_array($data['user_id'], array_keys($users))) { throw new MethodNotAllowedException(__('You are not authorised to do that.')); } + if (empty($data['expiration'])) { + $data['expiration'] = 0; + } return $data; } ]); diff --git a/templates/AuthKeys/add.php b/templates/AuthKeys/add.php index 4c829ec..5235c32 100644 --- a/templates/AuthKeys/add.php +++ b/templates/AuthKeys/add.php @@ -16,6 +16,7 @@ echo $this->element('genericElements/Form/genericForm', [ 'field' => 'expiration', 'label' => __('Expiration'), 'type' => 'datetime', + 'required' => false ] ], 'submit' => [