mirror of
https://github.com/zulip/zulip.git
synced 2026-06-30 21:11:04 +08:00
send_email: Only warn if EMAIL_HOST_PASSWORD is unset, not "".
Some email hosts actually do want an empty password; since the default is `None`, we should key on that, and not just being false-y.
This commit is contained in:
parent
9f8022de5e
commit
ee04f42897
@ -597,7 +597,7 @@ def log_email_config_errors() -> None:
|
||||
The purpose of this function is to log (potential) config errors,
|
||||
but without raising an exception.
|
||||
"""
|
||||
if settings.EMAIL_HOST_USER and not settings.EMAIL_HOST_PASSWORD:
|
||||
if settings.EMAIL_HOST_USER and settings.EMAIL_HOST_PASSWORD is None:
|
||||
logger.error(
|
||||
"An SMTP username was set (EMAIL_HOST_USER), but password is unset (EMAIL_HOST_PASSWORD)."
|
||||
)
|
||||
|
||||
@ -168,3 +168,13 @@ class TestSendEmail(ZulipTestCase):
|
||||
"An SMTP username was set (EMAIL_HOST_USER), but password is unset (EMAIL_HOST_PASSWORD)."
|
||||
],
|
||||
)
|
||||
|
||||
# Empty string is OK
|
||||
with self.settings(EMAIL_HOST_USER="test", EMAIL_HOST_PASSWORD=""):
|
||||
send_email(
|
||||
"zerver/emails/password_reset",
|
||||
to_emails=[hamlet],
|
||||
from_name="From Name",
|
||||
from_address=FromAddress.NOREPLY,
|
||||
language="en",
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user