Merge pull request #202 from muggenhor/less-verbose-imap-ssl-warn
IMAP: don't spam the logs about non-SSL connections to localhost
This commit is contained in:
commit
7772d11565
@ -40,9 +40,12 @@ IMAP_SERVER = config.get("auth", "imap_hostname")
|
|||||||
IMAP_SERVER_PORT = config.getint("auth", "imap_port")
|
IMAP_SERVER_PORT = config.getint("auth", "imap_port")
|
||||||
IMAP_USE_SSL = config.getboolean("auth", "imap_ssl")
|
IMAP_USE_SSL = config.getboolean("auth", "imap_ssl")
|
||||||
|
|
||||||
|
IMAP_WARNED_UNENCRYPTED = False
|
||||||
|
|
||||||
def is_authenticated(user, password):
|
def is_authenticated(user, password):
|
||||||
"""Check if ``user``/``password`` couple is valid."""
|
"""Check if ``user``/``password`` couple is valid."""
|
||||||
|
global IMAP_WARNED_UNENCRYPTED
|
||||||
|
|
||||||
if not user or not password:
|
if not user or not password:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -72,7 +75,8 @@ def is_authenticated(user, password):
|
|||||||
"IMAP server at %s failed to accept TLS connection "
|
"IMAP server at %s failed to accept TLS connection "
|
||||||
"because of: %s" % (IMAP_SERVER, exception))
|
"because of: %s" % (IMAP_SERVER, exception))
|
||||||
|
|
||||||
if server_is_local and not connection_is_secure:
|
if server_is_local and not connection_is_secure and not IMAP_WARNED_UNENCRYPTED:
|
||||||
|
IMAP_WARNED_UNENCRYPTED = True
|
||||||
log.LOGGER.warning(
|
log.LOGGER.warning(
|
||||||
"IMAP server is local. "
|
"IMAP server is local. "
|
||||||
"Will allow transmitting unencrypted credentials.")
|
"Will allow transmitting unencrypted credentials.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user