From a6a2b6982036eb6bebf9a1ff4d58ff4937ea3af1 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Tue, 15 Aug 2023 21:05:29 +0530 Subject: [PATCH] Make public subscription API follow the 'enable public' setting. --- cmd/public.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/public.go b/cmd/public.go index 7816ca316..ff8e6dc57 100644 --- a/cmd/public.go +++ b/cmd/public.go @@ -482,6 +482,14 @@ func handleSubscriptionForm(c echo.Context) error { // handlePublicSubscription handles subscription requests coming from public // API calls. func handlePublicSubscription(c echo.Context) error { + var ( + app = c.Get("app").(*App) + ) + + if !app.constants.EnablePublicSubPage { + return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("public.invalidFeature")) + } + hasOptin, err := processSubForm(c) if err != nil { return err