send user email once registration is sent
This commit is contained in:
@@ -2,11 +2,10 @@ package pages
|
||||
|
||||
import (
|
||||
"github.com/ProjectSegfault/publapi/utils"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"os"
|
||||
|
||||
"github.com/containrrr/shoutrrr"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -44,8 +43,14 @@ func SignupPage(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
log.Info("Registration request for " + username + " has been submitted by the frontend and has been written to /var/publapi/users/" + username + ".sh")
|
||||
// send notification to user that their reg request was sent
|
||||
err = shoutrrr.Send(os.Getenv("PUBLAPI_EMAIL_SHOUTRRRURL")+email, "Hello "+username+",\nYour registration request has been sent.\nIt will take a maximum of 48 hours for the request to be processed.\nThank you for being part of the Project Segfault Pubnix.")
|
||||
if err != nil {
|
||||
log.Error("Error sending email to user", err)
|
||||
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. IP: "+ip+" Email: "+email)
|
||||
err = shoutrrr.Send(os.Getenv("PUBLAPI_NOTIFY_SHOUTRRRURL"), "New user signup! Please review /var/publapi/users/"+username+".sh to approve or deny the user. IP: "+ip+" Email: "+email)
|
||||
if err != nil {
|
||||
log.Error("Error sending notification to admins", err)
|
||||
return c.SendStatus(fiber.StatusInternalServerError)
|
||||
|
Reference in New Issue
Block a user