From 21cfaad5c9bf87ab9405206e4cfc3ceffdc29d55 Mon Sep 17 00:00:00 2001
From: Ophestra Umiker <cat@ophivana.moe>
Date: Wed, 23 Oct 2024 18:02:37 +0900
Subject: [PATCH] fix(api): move captcha handler in front of registration
 handler

Examples in documentation has captcha after APi handler however that does not seem to work, so it is moved in front here.

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
---
 register.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/register.go b/register.go
index 00c5cdd..b69f70b 100644
--- a/register.go
+++ b/register.go
@@ -19,7 +19,7 @@ type registration struct {
 
 // Waitlist registration route
 func routeRegister(app *fiber.App, p string, db *leveldb.DB, count *atomic.Uint64, captcha fiber.Handler) {
-	app.Post(p, rateLimiter(), func(c fiber.Ctx) error {
+	app.Post(p, rateLimiter(), captcha, func(c fiber.Ctx) error {
 		t := time.Now().UTC()
 		req := new(registration)
 
@@ -68,5 +68,5 @@ func routeRegister(app *fiber.App, p string, db *leveldb.DB, count *atomic.Uint6
 		log.Printf("registered email %q", req.Email)
 		count.Add(1)
 		return c.JSON(newMessage(true, "Email registered successfully"))
-	}, captcha)
+	})
 }
-- 
GitLab