From 4b0a0d90619ee177efbe966007168e53811202bb Mon Sep 17 00:00:00 2001 From: Paul Dee Date: Tue, 13 Dec 2022 21:35:13 +0100 Subject: [PATCH] Skip PresharedKey generation (#271) Helpful for those who already have users deployed. Enter `-` in the Preshared Key field at user creation time to skip its creation. The template conf takes care of the rest. Fixes issue #235 --- handler/routes.go | 3 +++ templates/base.html | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/handler/routes.go b/handler/routes.go index ea34b8a..9439977 100644 --- a/handler/routes.go +++ b/handler/routes.go @@ -231,6 +231,9 @@ func NewClient(db store.IStore) echo.HandlerFunc { }) } client.PresharedKey = presharedKey.String() + } else if client.PresharedKey == "-" { + client.PresharedKey = "" + log.Infof("skipped PresharedKey generation for user: %v", client.Name) } else { _, err := wgtypes.ParseKey(client.PresharedKey) if err != nil { diff --git a/templates/base.html b/templates/base.html index d92e107..03d91bf 100644 --- a/templates/base.html +++ b/templates/base.html @@ -206,7 +206,7 @@ Public and Preshared Keys @@ -220,7 +220,7 @@ - +