From 05c655ede9fd3ce0d7d124bde70a367fb34152ba Mon Sep 17 00:00:00 2001 From: Felipe Cordova Huenupil <41532817+FelipeCordova@users.noreply.github.com> Date: Mon, 4 May 2026 03:21:18 -0400 Subject: [PATCH] fix(ui):Error pops up when enabling disabled client (#2594) * fix(ui):Error pops up when enabling disabled client Action is prevented and a clear message is displayed in Web UI * fix formatting * fix type issue * fix formatting --------- Co-authored-by: Bernd Storath <999999bst@gmail.com> --- src/server/api/client/[clientId]/enable.post.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/server/api/client/[clientId]/enable.post.ts b/src/server/api/client/[clientId]/enable.post.ts index 406c33ac..16f2fbb8 100644 --- a/src/server/api/client/[clientId]/enable.post.ts +++ b/src/server/api/client/[clientId]/enable.post.ts @@ -12,6 +12,19 @@ export default definePermissionEventHandler( const client = await Database.clients.get(clientId); checkPermissions(client); + if ( + client && + client.expiresAt !== null && + new Date() > new Date(client.expiresAt) + ) { + throw createError({ + statusCode: 422, + statusMessage: + 'Client is expired. Please update the expiration date first.', + message: 'Client is expired. Please update the expiration date first.', + }); + } + await Database.clients.toggle(clientId, true); await WireGuard.saveConfig(); return { success: true };