export testing
This commit is contained in:
		@@ -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 {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.go
									
									
									
									
									
								
							@@ -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)) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user