mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-29 06:27:14 +00:00
fix(email): stay silent when SMTP notifications are disabled
The event subscriber is registered unconditionally and only checked the per-event list (smtpEnabledEvents, default login.attempt,cpu.high) — not the smtpEnable master toggle. Login events are always published, so a panel with smtpEnable=false still attempted a send on every login and logged 'email subscriber: send failed: smtp host not configured'. Gate HandleEvent on GetSmtpEnable() so a disabled-SMTP panel does nothing, matching the comment where the subscriber is registered.
This commit is contained in:
@@ -31,6 +31,9 @@ func NewSubscriber(settingService service.SettingService, emailService *EmailSer
|
|||||||
|
|
||||||
// HandleEvent is the eventbus subscriber callback.
|
// HandleEvent is the eventbus subscriber callback.
|
||||||
func (s *Subscriber) HandleEvent(e eventbus.Event) {
|
func (s *Subscriber) HandleEvent(e eventbus.Event) {
|
||||||
|
if on, err := s.settingService.GetSmtpEnable(); err != nil || !on {
|
||||||
|
return
|
||||||
|
}
|
||||||
if !s.isEventEnabled(e.Type) {
|
if !s.isEventEnabled(e.Type) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user