From b4a8897f0e3a8fc4331898f87cba56074cf56abe Mon Sep 17 00:00:00 2001 From: Michael-u21546551 Date: Fri, 11 Oct 2024 11:32:08 +0200 Subject: [PATCH] Refactor middleware to include current time and timezone in after-hours access denial message --- occupi-backend/pkg/middleware/middleware.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/occupi-backend/pkg/middleware/middleware.go b/occupi-backend/pkg/middleware/middleware.go index 1cc22ecc..3b022498 100644 --- a/occupi-backend/pkg/middleware/middleware.go +++ b/occupi-backend/pkg/middleware/middleware.go @@ -317,7 +317,10 @@ func BlockAfterHours(now time.Time) gin.HandlerFunc { "Forbidden", constants.ForbiddenCode, fmt.Sprintf("Access denied after hours, only allowed between 08:00 and 17:00, time now is %s", now.Format("15:04")), - nil)) + gin.H{ + "serverTime": now.Format("2006-01-02 15:04:05"), + "serverTimezone": timeZone, + })) ctx.Abort() return }