lets enable alert emails

This commit is contained in:
Your Name 2020-07-23 18:12:44 -04:00
parent 4388b126e2
commit 1dcb3e80c4
1 changed files with 6 additions and 6 deletions

12
main.go
View File

@ -90,7 +90,7 @@ func Register(username, email, ip string) bool {
log.Printf("scsusers.Register: insert failed: %s\n", err.Error())
return false
}
if sendRegistrationEmail(email, username, string(pass)) {
if SendRegistrationEmail(email, username, string(pass)) {
log.Printf("scsusers.Register: New user registration: %s from %s\n", username, ip)
return true
}
@ -282,7 +282,7 @@ func RecoverByUsername(username string) {
qq := fmt.Sprintf("update %s_auth set recoverycode=$1, recoverytime=NOW() where username = $2", c.TablePrefix)
_, err := c.db.Exec(qq, recoverycode, username)
if err == nil {
sendRecoveryEmail(email, username, string(recoverycode))
SendRecoveryEmail(email, username, string(recoverycode))
}
}
}
@ -296,7 +296,7 @@ func RecoverByEmail(e string) {
qq := fmt.Sprintf("update %s_auth set recoverycode=$1, recoverytime=NOW() where username = $2", c.TablePrefix)
_, err := c.db.Exec(qq, recoverycode, username)
if err == nil {
sendRecoveryEmail(email, username, string(recoverycode))
SendRecoveryEmail(email, username, string(recoverycode))
}
}
}
@ -310,7 +310,7 @@ func randBytes(n int) []byte {
return []byte(base32.StdEncoding.EncodeToString(randomBytes)[:n])
}
func sendRegistrationEmail(recipient, username, password string) bool {
func SendRegistrationEmail(recipient, username, password string) bool {
data := struct {
SiteName string
FromEmail string
@ -337,7 +337,7 @@ func sendRegistrationEmail(recipient, username, password string) bool {
return true
}
func sendAlertEmail(username, recipient, message string) bool {
func SendAlertEmail(username, recipient, message string) bool {
data := struct {
SiteName string
FromEmail string
@ -365,7 +365,7 @@ func sendAlertEmail(username, recipient, message string) bool {
return true
}
func sendRecoveryEmail(recipient, username, code string) bool {
func SendRecoveryEmail(recipient, username, code string) bool {
data := struct {
SiteName string
FromEmail string