move testing to just alerts
This commit is contained in:
parent
7214e0a73f
commit
b79e38a5f9
|
@ -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)
|
||||
|
|
4
main.go
4
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
|
||||
|
|
Loading…
Reference in New Issue