Fix bug in node update

This commit is contained in:
Dane Everitt 2017-02-16 15:57:02 -05:00
parent 59f9ab6e90
commit 73996d3154
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 4 additions and 5 deletions

View file

@ -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();

View file

@ -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']);