Skip to content

Commit

Permalink
VPN: WireGuard: Settings - minor regression in addClient, not adding …
Browse files Browse the repository at this point in the history
…created uuid. (opnsense/plugins@47ccdcc)
  • Loading branch information
AdSchellevis committed Nov 10, 2023
1 parent 7dc48d4 commit 392a549
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -73,6 +73,7 @@ public function delClientAction($uuid)

public function setClientAction($uuid)
{
$add_uuid = null;
if (!empty($this->request->getPost(static::$internalModelName)) && $this->request->isPost()) {
$servers = [];
if (!empty($this->request->getPost(static::$internalModelName)['servers'])) {
Expand All @@ -83,6 +84,7 @@ public function setClientAction($uuid)
if (empty($uuid)) {
// add new client, generate uuid
$uuid = $mdl->servers->generateUUID();
$add_uuid = $uuid;
}
foreach ($mdl->servers->server->iterateItems() as $key => $node) {
$peers = array_filter(explode(',', (string)$node->peers));
Expand All @@ -99,7 +101,11 @@ public function setClientAction($uuid)
*/
$mdl->serializeToConfig(false, true);
}
return $this->setBase('client', 'clients.client', $uuid);
$result = $this->setBase('client', 'clients.client', $uuid);
if (!empty($add_uuid) && $result['result'] == 'saved') {
$result['uuid'] = $add_uuid;
}
return $result;
}

public function toggleClientAction($uuid)
Expand Down

0 comments on commit 392a549

Please sign in to comment.