package pages import ( "fmt" "os" "github.com/gofiber/fiber/v2" "github.com/containrrr/shoutrrr" log "github.com/sirupsen/logrus" ) // SignupPage is the signup page handler func SignupPage(c *fiber.Ctx) error { username := c.FormValue("username") email := c.FormValue("email") if username == "" || email == "" { log.Error("Username or email is empty", username, email) return c.SendStatus(fiber.StatusBadRequest) } // generate password pass, err := password.Generate(30, 10, 10, false, false) if err != nil { log.Error("Error generating password", err) return c.SendStatus(fiber.StatusInternalServerError) } // create user file f, err := os.Create("/var/publapi/users/" + username + ".sh") if err != nil { log.Error("Error creating user file", err) return c.SendStatus(fiber.StatusInternalServerError) } defer f.Close() bashscript := "#!/bin/bash \n" + "# Path: /var/publapi/users/" + username + ".sh\n" + "# This file is generated by publapi. Do not edit this file.\n" + "pass=\"$(tr -dc A-Za-z0-9