mark a mailbox as unverified if it fails checks for too many times

This commit is contained in:
Son NK 2020-09-10 09:40:27 +02:00
parent e6dd2f1717
commit f224d16c56

View file

@ -297,6 +297,7 @@ def sanity_check():
# alert if too much fail and nb_email_log > 100 # alert if too much fail and nb_email_log > 100
if mailbox.nb_failed_checks > 10 and nb_email_log > 100: if mailbox.nb_failed_checks > 10 and nb_email_log > 100:
log_func = LOG.exception log_func = LOG.exception
mailbox.verified = False
else: else:
log_func = LOG.warning log_func = LOG.warning
@ -309,7 +310,7 @@ def sanity_check():
else: # reset nb check else: # reset nb check
mailbox.nb_failed_checks = 0 mailbox.nb_failed_checks = 0
db.session.commit() db.session.commit()
for user in User.filter_by(activated=True).all(): for user in User.filter_by(activated=True).all():
if user.email.lower() != user.email: if user.email.lower() != user.email: