fix get auth info
This commit is contained in:
parent
877a2b9414
commit
c99fce0ae6
|
@ -338,7 +338,7 @@ func (h *EmailAPI) testEmailServer(w http.ResponseWriter, req *http.Request, ps
|
|||
h.WriteError(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
if reqBody.Auth.Password == "" && reqBody.CredentialID != "" {
|
||||
if reqBody.CredentialID != "" {
|
||||
auth, err := common.GetBasicAuth(&reqBody.EmailServer)
|
||||
if err != nil {
|
||||
h.WriteError(w, err.Error(), http.StatusInternalServerError)
|
||||
|
@ -346,6 +346,10 @@ func (h *EmailAPI) testEmailServer(w http.ResponseWriter, req *http.Request, ps
|
|||
}
|
||||
reqBody.Auth = &auth
|
||||
}
|
||||
if reqBody.Auth == nil {
|
||||
h.WriteError(w, "auth info required", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
message := gomail.NewMessage()
|
||||
message.SetHeader("From", reqBody.Auth.Username)
|
||||
message.SetHeader("To", reqBody.SendTo...)
|
||||
|
|
Loading…
Reference in New Issue