test email server with old password when password is empty and username equals
This commit is contained in:
parent
3709f5683d
commit
ce98378a7c
|
@ -293,6 +293,18 @@ func (h *EmailAPI) testEmailServer(w http.ResponseWriter, req *http.Request, ps
|
||||||
h.WriteError(w, err.Error(), http.StatusInternalServerError)
|
h.WriteError(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if reqBody.Auth.Password == "" && reqBody.ID != "" {
|
||||||
|
obj := model.EmailServer{}
|
||||||
|
obj.ID = reqBody.ID
|
||||||
|
_, err := orm.Get(&obj)
|
||||||
|
if err != nil {
|
||||||
|
h.WriteError(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if reqBody.Auth.Username == obj.Auth.Username {
|
||||||
|
reqBody.Auth.Password = obj.Auth.Password
|
||||||
|
}
|
||||||
|
}
|
||||||
message := gomail.NewMessage()
|
message := gomail.NewMessage()
|
||||||
message.SetHeader("From", reqBody.Auth.Username)
|
message.SetHeader("From", reqBody.Auth.Username)
|
||||||
message.SetHeader("To", reqBody.SendTo...)
|
message.SetHeader("To", reqBody.SendTo...)
|
||||||
|
|
Loading…
Reference in New Issue