export testing

This commit is contained in:
Your Name 2024-01-02 10:13:52 -05:00
parent bdfa19c7ec
commit d1f7dcba1b
2 changed files with 6 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import (
"time" "time"
) )
//
func SendRegistrationEmail(recipient, username, password string) bool { func SendRegistrationEmail(recipient, username, password string) bool {
data := struct { data := struct {
SiteName string SiteName string
@ -64,6 +65,7 @@ func SendAlertEmail(username, recipient, message string) bool {
return true return true
} }
func SendRecoveryEmail(recipient, username, code string) bool { func SendRecoveryEmail(recipient, username, code string) bool {
data := struct { data := struct {
SiteName string SiteName string
@ -91,6 +93,7 @@ func SendRecoveryEmail(recipient, username, code string) bool {
return true return true
} }
//
func Send2faEmail(recipient, fullname, code string) error { func Send2faEmail(recipient, fullname, code string) error {
data := struct { data := struct {
SiteName string SiteName string
@ -153,6 +156,7 @@ func SendMail(addr, from, subject, body string, to string) error {
return c.Quit() return c.Quit()
} }
//
func SendAlert(u int64, subject, body string) error { func SendAlert(u int64, subject, body string) error {
user, ok := GetById(u) user, ok := GetById(u)
if !ok { if !ok {

View File

@ -24,7 +24,7 @@ type config struct {
Templates templates Templates templates
SMTPServer string SMTPServer string
db *sqlx.DB db *sqlx.DB
testing bool Testing bool
TablePrefix string TablePrefix string
} }
@ -95,7 +95,7 @@ func Register(username, email, ip string) bool {
log.Printf("scsusers.Register: insert failed: %s\n", err.Error()) log.Printf("scsusers.Register: insert failed: %s\n", err.Error())
return false return false
} }
if c.testing { if c.Testing {
return true return true
} }
if SendRegistrationEmail(email, username, string(pass)) { if SendRegistrationEmail(email, username, string(pass)) {