From b1034bca1659e80cd14fdaaa87cc8d31a4739140 Mon Sep 17 00:00:00 2001 From: Odyssey Date: Sat, 7 Jan 2023 17:02:06 +0100 Subject: [PATCH] Fix syntax Signed-off-by: Odyssey --- main.go | 1 + pages/signup.go | 14 ++++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index 73a24d1..9a45159 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "github.com/gofiber/fiber/v2" ) +// publapi is a simple API for Project Segfault's public shared server (pubnix). func main() { app := fiber.New() diff --git a/pages/signup.go b/pages/signup.go index 77beb99..a8159ee 100644 --- a/pages/signup.go +++ b/pages/signup.go @@ -25,12 +25,6 @@ func SignupPage(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusInternalServerError) } - // send notification to admins - err = shoutrrr.Send(os.Getenv("PUBLAPI_SHOUTRRRURL"), "New user signup! Please review /var/publapi/users/"+username+".sh to approve or deny the user.") - if err != nil { - return c.SendStatus(fiber.StatusInternalServerError) - } - // create user file f, err := os.Create("/var/publapi/users/" + username + ".sh") if err != nil { @@ -42,7 +36,7 @@ func SignupPage(c *fiber.Ctx) error { "# Path: /var/publapi/users/.sh\n" + "# This file is generated by publapi. Do not edit this file.\n" + "useradd -Um -s /bin/bash " + username + "\n" + - "printf \"%s\n%s\n\" \"" + pass + " " + pass + " | passwd " + username + + "printf %s\n%s\n" + pass + " " + pass + " | passwd " + username + "\n" + "echo " + username + "'s account has been created!" fmt.Println(bashscript) @@ -53,9 +47,13 @@ func SignupPage(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusInternalServerError) } + // send notification to admins + err = shoutrrr.Send(os.Getenv("PUBLAPI_SHOUTRRRURL"), "New user signup! Please review /var/publapi/users/"+username+".sh to approve or deny the user.") + if err != nil { + return c.SendStatus(fiber.StatusInternalServerError) + } return c.JSON(fiber.Map{ "username": username, - "pass": pass, "message": "User created! Please allow us 24 hours or more to review your account.", "status": c.Response().StatusCode(), })