From 9fa8550ef67bf59c77f32a94d6756713c90a6dc4 Mon Sep 17 00:00:00 2001 From: binwiederhier Date: Sat, 13 Jun 2026 13:42:32 -0400 Subject: [PATCH] Remove Close() on Sender; words on password dialog --- mail/sender.go | 6 ------ server/errors.go | 2 +- server/server.go | 3 --- server/server_account.go | 4 ++-- server/server_account_email_test.go | 2 -- server/smtp_sender.go | 1 - web/public/static/langs/en.json | 2 +- 7 files changed, 4 insertions(+), 16 deletions(-) diff --git a/mail/sender.go b/mail/sender.go index b840adf1..3215c332 100644 --- a/mail/sender.go +++ b/mail/sender.go @@ -36,12 +36,6 @@ func NewSender(config *Config) *Sender { return &Sender{config: config} } -// Close is a no-op, kept so callers don't need to special-case the sender. The sender holds -// no background goroutines (magic-link expiry is swept by the user.Manager reaper). -func (s *Sender) Close() { - // Nothing to do -} - // Addr returns the SMTP server address func (s *Sender) Addr() string { return s.config.SMTPAddr diff --git a/server/errors.go b/server/errors.go index d204aa53..6a7bd769 100644 --- a/server/errors.go +++ b/server/errors.go @@ -143,7 +143,7 @@ var ( errHTTPBadRequestTemplateFileInvalid = &errHTTP{40048, http.StatusBadRequest, "invalid request: template file invalid", "https://ntfy.sh/docs/publish/#message-templating", nil} errHTTPBadRequestSequenceIDInvalid = &errHTTP{40049, http.StatusBadRequest, "invalid request: sequence ID invalid", "https://ntfy.sh/docs/publish/#updating-deleting-notifications", nil} errHTTPBadRequestEmailAddressInvalid = &errHTTP{40050, http.StatusBadRequest, "invalid request: invalid e-mail address", "https://ntfy.sh/docs/publish/#e-mail-notifications", nil} - errHTTPBadRequestEmailVerificationCodeInvalid = &errHTTP{40051, http.StatusBadRequest, "invalid request: email verification link invalid or expired", "", nil} + errHTTPBadRequestEmailVerificationLinkInvalid = &errHTTP{40051, http.StatusBadRequest, "invalid request: email verification link invalid or expired", "", nil} errHTTPBadRequestEmailAddressNotVerified = &errHTTP{40052, http.StatusBadRequest, "invalid request: email address not verified", "https://ntfy.sh/docs/publish/#e-mail-notifications", nil} errHTTPBadRequestAnonymousEmailNotAllowed = &errHTTP{40053, http.StatusBadRequest, "invalid request: anonymous email sending is not allowed", "https://ntfy.sh/docs/publish/#e-mail-notifications", nil} errHTTPBadRequestResetLinkInvalid = &errHTTP{40054, http.StatusBadRequest, "invalid request: password reset link invalid or expired", "", nil} diff --git a/server/server.go b/server/server.go index 3184478a..4cbc7984 100644 --- a/server/server.go +++ b/server/server.go @@ -452,9 +452,6 @@ func (s *Server) Stop() { if s.smtpServer != nil { s.smtpServer.Close() } - if s.mailSender != nil { - s.mailSender.Close() - } if s.attachment != nil { s.attachment.Close() } diff --git a/server/server_account.go b/server/server_account.go index 644a9283..621fe63b 100644 --- a/server/server_account.go +++ b/server/server_account.go @@ -690,11 +690,11 @@ func (s *Server) handleAccountEmailVerify(w http.ResponseWriter, r *http.Request if err != nil { return err } else if req.Token == "" { - return errHTTPBadRequestEmailVerificationCodeInvalid + return errHTTPBadRequestEmailVerificationLinkInvalid } m, err := s.userManager.VerifyEmail(req.Token) if errors.Is(err, user.ErrMagicLinkNotFound) { - return errHTTPBadRequestEmailVerificationCodeInvalid + return errHTTPBadRequestEmailVerificationLinkInvalid } else if err != nil { return err } diff --git a/server/server_account_email_test.go b/server/server_account_email_test.go index 1b216c12..eb66ba2c 100644 --- a/server/server_account_email_test.go +++ b/server/server_account_email_test.go @@ -32,8 +32,6 @@ func (c *captureMailer) SendPasswordReset(to, link string) error { return nil } -func (c *captureMailer) Close() {} - // newEmailTestServer creates a server with email sending "enabled" (SMTP + base-url configured) // and a capturing mailer injected, plus a tier-less user "ben" logged in via basic auth. func newEmailTestServer(t *testing.T, databaseURL string) (*Server, *captureMailer, map[string]string) { diff --git a/server/smtp_sender.go b/server/smtp_sender.go index 1e7460e8..199cecd9 100644 --- a/server/smtp_sender.go +++ b/server/smtp_sender.go @@ -25,7 +25,6 @@ type mailer interface { type emailVerifier interface { SendEmailVerification(to, link string) error SendPasswordReset(to, link string) error - Close() } type smtpSender struct { diff --git a/web/public/static/langs/en.json b/web/public/static/langs/en.json index 6b207f2d..e8926227 100644 --- a/web/public/static/langs/en.json +++ b/web/public/static/langs/en.json @@ -30,7 +30,7 @@ "login_link_signup": "Sign up", "login_link_forgot_password": "Forgot password?", "reset_password_request_title": "Reset password", - "reset_password_request_description": "Enter your username or email address. If an account exists, a link to reset your password will be emailed.", + "reset_password_request_description": "Enter your username or email address. If an account exists, a link to reset your password will be emailed. This only works if you already added a primary email address and verified it.", "reset_password_request_identifier_label": "Username or email", "reset_password_request_button_submit": "Send reset link", "reset_password_sent_title": "Check your inbox",