mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-05 12:24:20 +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.
|
||||
func (s *Subscriber) HandleEvent(e eventbus.Event) {
|
||||
if on, err := s.settingService.GetSmtpEnable(); err != nil || !on {
|
||||
return
|
||||
}
|
||||
if !s.isEventEnabled(e.Type) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user