mirror of
https://github.com/multipleof4/ntfy.git
synced 2026-10-17 00:47:54 +00:00
Remove Close() on Sender; words on password dialog
This commit is contained in:
@@ -36,12 +36,6 @@ func NewSender(config *Config) *Sender {
|
|||||||
return &Sender{config: config}
|
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
|
// Addr returns the SMTP server address
|
||||||
func (s *Sender) Addr() string {
|
func (s *Sender) Addr() string {
|
||||||
return s.config.SMTPAddr
|
return s.config.SMTPAddr
|
||||||
|
|||||||
+1
-1
@@ -143,7 +143,7 @@ var (
|
|||||||
errHTTPBadRequestTemplateFileInvalid = &errHTTP{40048, http.StatusBadRequest, "invalid request: template file invalid", "https://ntfy.sh/docs/publish/#message-templating", nil}
|
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}
|
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}
|
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}
|
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}
|
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}
|
errHTTPBadRequestResetLinkInvalid = &errHTTP{40054, http.StatusBadRequest, "invalid request: password reset link invalid or expired", "", nil}
|
||||||
|
|||||||
@@ -452,9 +452,6 @@ func (s *Server) Stop() {
|
|||||||
if s.smtpServer != nil {
|
if s.smtpServer != nil {
|
||||||
s.smtpServer.Close()
|
s.smtpServer.Close()
|
||||||
}
|
}
|
||||||
if s.mailSender != nil {
|
|
||||||
s.mailSender.Close()
|
|
||||||
}
|
|
||||||
if s.attachment != nil {
|
if s.attachment != nil {
|
||||||
s.attachment.Close()
|
s.attachment.Close()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -690,11 +690,11 @@ func (s *Server) handleAccountEmailVerify(w http.ResponseWriter, r *http.Request
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if req.Token == "" {
|
} else if req.Token == "" {
|
||||||
return errHTTPBadRequestEmailVerificationCodeInvalid
|
return errHTTPBadRequestEmailVerificationLinkInvalid
|
||||||
}
|
}
|
||||||
m, err := s.userManager.VerifyEmail(req.Token)
|
m, err := s.userManager.VerifyEmail(req.Token)
|
||||||
if errors.Is(err, user.ErrMagicLinkNotFound) {
|
if errors.Is(err, user.ErrMagicLinkNotFound) {
|
||||||
return errHTTPBadRequestEmailVerificationCodeInvalid
|
return errHTTPBadRequestEmailVerificationLinkInvalid
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ func (c *captureMailer) SendPasswordReset(to, link string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *captureMailer) Close() {}
|
|
||||||
|
|
||||||
// newEmailTestServer creates a server with email sending "enabled" (SMTP + base-url configured)
|
// 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.
|
// 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) {
|
func newEmailTestServer(t *testing.T, databaseURL string) (*Server, *captureMailer, map[string]string) {
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ type mailer interface {
|
|||||||
type emailVerifier interface {
|
type emailVerifier interface {
|
||||||
SendEmailVerification(to, link string) error
|
SendEmailVerification(to, link string) error
|
||||||
SendPasswordReset(to, link string) error
|
SendPasswordReset(to, link string) error
|
||||||
Close()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type smtpSender struct {
|
type smtpSender struct {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
"login_link_signup": "Sign up",
|
"login_link_signup": "Sign up",
|
||||||
"login_link_forgot_password": "Forgot password?",
|
"login_link_forgot_password": "Forgot password?",
|
||||||
"reset_password_request_title": "Reset 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_identifier_label": "Username or email",
|
||||||
"reset_password_request_button_submit": "Send reset link",
|
"reset_password_request_button_submit": "Send reset link",
|
||||||
"reset_password_sent_title": "Check your inbox",
|
"reset_password_sent_title": "Check your inbox",
|
||||||
|
|||||||
Reference in New Issue
Block a user