Replace the error code with an actual response for the end user.

This commit is contained in:
Midou 2023-07-10 23:08:46 +01:00
parent c8ca445bb7
commit e22aa46ae7
Signed by: midou
GPG Key ID: 1D134A95FE521A7A
1 changed files with 5 additions and 2 deletions

View File

@ -93,9 +93,12 @@ func SignupPage(c *fiber.Ctx) error {
if captchaResponse.Success == false {
log.Error("Captcha validation failed")
return c.SendStatus(fiber.StatusBadRequest)
return c.JSON(fiber.Map{
"username": username,
"message": "Sorry! But the captcha validation failed. Please try again.",
"status": c.Response().StatusCode(),
})
} else {
// create user file
f, err := os.Create("/var/publapi/users/" + username + ".sh")