Fix syntax

Signed-off-by: Odyssey <odyssey346@disroot.org>
This commit is contained in:
Odyssey 2023-01-07 17:02:06 +01:00
parent d633ccfb25
commit b1034bca16
2 changed files with 7 additions and 8 deletions

View File

@ -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()

View File

@ -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(),
})