From b79e38a5f9bbb72572dbf054cda9485b076cf89a Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 10 Jan 2024 14:35:09 -0500 Subject: [PATCH] move testing to just alerts --- emails.go | 5 ++++- main.go | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/emails.go b/emails.go index 9242763..2892bf1 100644 --- a/emails.go +++ b/emails.go @@ -9,7 +9,7 @@ import ( "time" ) -// +// func SendRegistrationEmail(recipient, username, password string) bool { data := struct { SiteName string @@ -158,6 +158,9 @@ func SendMail(addr, from, subject, body string, to string) error { // func SendAlert(u int64, subject, body string) error { + if c.Testing { + return nil + } user, ok := GetById(u) if !ok { return fmt.Errorf("scsusers.SendAlert: User %d not found", u) diff --git a/main.go b/main.go index 46ebae4..b6d49dc 100644 --- a/main.go +++ b/main.go @@ -96,9 +96,7 @@ func Register(username, email, ip string) bool { log.Printf("scsusers.Register: insert failed: %s\n", err.Error()) return false } - if c.Testing { - return true - } + if SendRegistrationEmail(email, username, string(pass)) { log.Printf("scsusers.Register: New user registration: %s from %s\n", username, ip) return true