From 73996d315461bad504eee8105c268b2795d40cf2 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Thu, 16 Feb 2017 15:57:02 -0500 Subject: [PATCH] Fix bug in node update --- app/Http/Controllers/Admin/NodesController.php | 3 +-- app/Repositories/NodeRepository.php | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Admin/NodesController.php b/app/Http/Controllers/Admin/NodesController.php index c1aa6a0c2..f90cab991 100644 --- a/app/Http/Controllers/Admin/NodesController.php +++ b/app/Http/Controllers/Admin/NodesController.php @@ -126,8 +126,7 @@ class NodesController extends Controller 'fqdn', 'scheme', 'memory', 'memory_overallocate', 'disk', 'disk_overallocate', 'upload_size', - 'daemonBase', 'daemonSFTP', - 'daemonListen', 'reset_secret', + 'daemonSFTP', 'daemonListen', 'reset_secret', ])); Alert::success('Successfully update this node\'s information. If you changed any daemon settings you will need to restart it now.')->flash(); diff --git a/app/Repositories/NodeRepository.php b/app/Repositories/NodeRepository.php index c0d85adf5..56dbd37c2 100644 --- a/app/Repositories/NodeRepository.php +++ b/app/Repositories/NodeRepository.php @@ -100,10 +100,10 @@ class NodeRepository 'disk' => 'numeric|min:1', 'disk_overallocate' => 'numeric|min:-1', 'upload_size' => 'numeric|min:0', - 'daemonBase' => 'regex:/^([\/][\d\w.\-\/]+)$/', + 'daemonBase' => 'sometimes|regex:/^([\/][\d\w.\-\/]+)$/', 'daemonSFTP' => 'numeric|between:1,65535', 'daemonListen' => 'numeric|between:1,65535', - 'reset_secret' => 'sometimes|accepted', + 'reset_secret' => 'sometimes|nullable|accepted', ]); // Run validator, throw catchable and displayable exception if it fails. @@ -138,7 +138,7 @@ class NodeRepository } // Set the Secret - if (isset($data['reset_secret'])) { + if (isset($data['reset_secret']) && ! is_null($data['reset_secret'])) { $uuid = new UuidService; $data['daemonSecret'] = (string) $uuid->generate('nodes', 'daemonSecret'); unset($data['reset_secret']);