diff --git a/src/acme.go b/src/acme.go index f1b54c5..4dd7cd4 100644 --- a/src/acme.go +++ b/src/acme.go @@ -101,6 +101,7 @@ func AcmeCheckAndHandleRenewCertificate(w http.ResponseWriter, r *http.Request) } else { //This port do not support ACME utils.SendErrorResponse(w, "ACME renew only support web server listening on port 80 (http) or 443 (https)") + return } //Add a 3 second delay to make sure everything is settle down @@ -109,6 +110,10 @@ func AcmeCheckAndHandleRenewCertificate(w http.ResponseWriter, r *http.Request) // Pass over to the acmeHandler to deal with the communication acmeHandler.HandleRenewCertificate(w, r) + //Update the TLS cert store buffer + tlsCertManager.UpdateLoadedCertList() + + //Restore original settings if dynamicProxyRouter.Option.Port == 443 { if !isForceHttpsRedirectEnabledOriginally { //Default is off. Turn the redirection off diff --git a/src/emails.go b/src/emails.go index 9946d28..529d25d 100644 --- a/src/emails.go +++ b/src/emails.go @@ -25,12 +25,6 @@ func HandleSMTPSet(w http.ResponseWriter, r *http.Request) { return } - domain, err := utils.PostPara(r, "domain") - if err != nil { - //Assume domain is empty, raised by issue #129 - domain = "" - } - portString, err := utils.PostPara(r, "port") if err != nil { utils.SendErrorResponse(w, "port must be a valid integer") @@ -76,7 +70,6 @@ func HandleSMTPSet(w http.ResponseWriter, r *http.Request) { //Set the email sender properties thisEmailSender := email.Sender{ Hostname: strings.TrimSpace(hostname), - Domain: strings.TrimSpace(domain), Port: port, Username: strings.TrimSpace(username), Password: strings.TrimSpace(password), diff --git a/src/mod/email/email.go b/src/mod/email/email.go index 878b130..36946fc 100644 --- a/src/mod/email/email.go +++ b/src/mod/email/email.go @@ -13,7 +13,6 @@ import ( type Sender struct { Hostname string //E.g. mail.gandi.net - Domain string //E.g. arozos.com Port int //E.g. 587 Username string //Username of the email account Password string //Password of the email account @@ -21,10 +20,9 @@ type Sender struct { } // Create a new email sender object -func NewEmailSender(hostname string, domain string, port int, username string, password string, senderAddr string) *Sender { +func NewEmailSender(hostname string, port int, username string, password string, senderAddr string) *Sender { return &Sender{ Hostname: hostname, - Domain: domain, Port: port, Username: username, Password: password, @@ -52,12 +50,8 @@ func (s *Sender) SendEmail(to string, subject string, content string) error { content + "\n\n") //Login to the SMTP server - var auth smtp.Auth - if s.Domain == "" { - auth = smtp.PlainAuth("", s.Username, s.Password, s.Hostname) - } else { - auth = smtp.PlainAuth("", s.Username+"@"+s.Domain, s.Password, s.Hostname) - } + //Username can be username (e.g. admin) or email (e.g. admin@example.com), depending on SMTP service provider + auth := smtp.PlainAuth("", s.Username, s.Password, s.Hostname) err := smtp.SendMail(s.Hostname+":"+strconv.Itoa(s.Port), auth, s.SenderAddr, []string{to}, msg) if err != nil { diff --git a/src/web/components/utils.html b/src/web/components/utils.html index e4dc346..965d2b6 100644 --- a/src/web/components/utils.html +++ b/src/web/components/utils.html @@ -65,21 +65,9 @@
Credentials for SMTP server authentications
-