Skip to content
Snippets Groups Projects
Verified Commit 21cfaad5 authored by Ophestra's avatar Ophestra
Browse files

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: default avatarOphestra Umiker <cat@ophivana.moe>
parent bd42dce4
Branches
Tags v0.0.6
1 merge request!13fix(api): move captcha handler in front of registration handler
Pipeline #995 passed
...@@ -19,7 +19,7 @@ type registration struct { ...@@ -19,7 +19,7 @@ type registration struct {
// Waitlist registration route // Waitlist registration route
func routeRegister(app *fiber.App, p string, db *leveldb.DB, count *atomic.Uint64, captcha fiber.Handler) { 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() t := time.Now().UTC()
req := new(registration) req := new(registration)
...@@ -68,5 +68,5 @@ func routeRegister(app *fiber.App, p string, db *leveldb.DB, count *atomic.Uint6 ...@@ -68,5 +68,5 @@ func routeRegister(app *fiber.App, p string, db *leveldb.DB, count *atomic.Uint6
log.Printf("registered email %q", req.Email) log.Printf("registered email %q", req.Email)
count.Add(1) count.Add(1)
return c.JSON(newMessage(true, "Email registered successfully")) return c.JSON(newMessage(true, "Email registered successfully"))
}, captcha) })
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment