export testing
This commit is contained in:
		@@ -9,6 +9,7 @@ import (
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// 
 | 
			
		||||
func SendRegistrationEmail(recipient, username, password string) bool {
 | 
			
		||||
	data := struct {
 | 
			
		||||
		SiteName  string
 | 
			
		||||
@@ -64,6 +65,7 @@ func SendAlertEmail(username, recipient, message string) bool {
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func SendRecoveryEmail(recipient, username, code string) bool {
 | 
			
		||||
	data := struct {
 | 
			
		||||
		SiteName     string
 | 
			
		||||
@@ -91,6 +93,7 @@ func SendRecoveryEmail(recipient, username, code string) bool {
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
func Send2faEmail(recipient, fullname, code string) error {
 | 
			
		||||
	data := struct {
 | 
			
		||||
		SiteName  string
 | 
			
		||||
@@ -153,6 +156,7 @@ func SendMail(addr, from, subject, body string, to string) error {
 | 
			
		||||
	return c.Quit()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
func SendAlert(u int64, subject, body string) error {
 | 
			
		||||
	user, ok := GetById(u)
 | 
			
		||||
	if !ok {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.go
									
									
									
									
									
								
							@@ -24,7 +24,7 @@ type config struct {
 | 
			
		||||
	Templates   templates
 | 
			
		||||
	SMTPServer  string
 | 
			
		||||
	db          *sqlx.DB
 | 
			
		||||
	testing     bool
 | 
			
		||||
	Testing     bool
 | 
			
		||||
	TablePrefix string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -95,7 +95,7 @@ func Register(username, email, ip string) bool {
 | 
			
		||||
		log.Printf("scsusers.Register: insert failed: %s\n", err.Error())
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
	if c.testing {
 | 
			
		||||
	if c.Testing {
 | 
			
		||||
		return true
 | 
			
		||||
	}
 | 
			
		||||
	if SendRegistrationEmail(email, username, string(pass)) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user