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' => [