mirror of https://github.com/gophish/gophish
Working on SendMail (currently NOT functional)
Added user model for kicks - we'll see if it finds a reason to stay Setup /users and /settings routespull/24/head
parent
a64b0c10c9
commit
5a5c9f600f
|
@ -4,6 +4,13 @@ import (
|
|||
"net/smtp"
|
||||
)
|
||||
|
||||
//Send sends an Email using a connection to Server.
|
||||
//If a Username and Password are set for the Server, authentication will be attempted
|
||||
//However, to support open-relays, authentication is optional.
|
||||
func Send(email Email, server Server) {
|
||||
auth = smtp.PlainAuth("", server.User, server.Password, server.Server)
|
||||
auth := nil
|
||||
if server.User != nil && server.Password != nil {
|
||||
auth := smtp.PlainAuth("", server.User, server.Password, server.Host)
|
||||
}
|
||||
smtp.SendMail(server.Host, auth, email.From, email.To, Email.Body)
|
||||
}
|
||||
|
|
|
@ -19,3 +19,10 @@ type Config struct {
|
|||
URL string `json:"url"`
|
||||
SMTP SMTPServer `json:"smtp"`
|
||||
}
|
||||
|
||||
type User struct {
|
||||
Id string
|
||||
Username string
|
||||
Hash string
|
||||
APIKey string
|
||||
}
|
||||
|
|
10
route.go
10
route.go
|
@ -43,6 +43,8 @@ func createRouter() http.Handler {
|
|||
router.HandleFunc("/login", Login)
|
||||
router.HandleFunc("/register", Register)
|
||||
router.HandleFunc("/campaigns", Base_Campaigns)
|
||||
router.HandleFunc("/users", Users)
|
||||
router.HandleFunc("/settings", Settings)
|
||||
|
||||
// Create the API routes
|
||||
api := router.PathPrefix("/api").Subrouter()
|
||||
|
@ -69,6 +71,14 @@ func Base(w http.ResponseWriter, r *http.Request) {
|
|||
renderTemplate(w, "dashboard")
|
||||
}
|
||||
|
||||
func Users(w http.ResponseWriter, r *http.Request) {
|
||||
renderTemplate(w, "users")
|
||||
}
|
||||
|
||||
func Settings(w http.ResponseWriter, r *http.Request) {
|
||||
renderTemplate(w, "settings")
|
||||
}
|
||||
|
||||
func Base_Campaigns(w http.ResponseWriter, r *http.Request) {
|
||||
//session, _ := store.Get(r, "gophish")
|
||||
renderTemplate(w, "dashboard")
|
||||
|
|
Loading…
Reference in New Issue