1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-01-30 04:30:49 +02:00

Merge remote-tracking branch 'origin/improve-logs' into improve-logs

This commit is contained in:
Florent Daigniere 2023-05-13 11:59:22 +02:00
commit c68f4d93cf

View File

@ -29,7 +29,7 @@ WEBMAIL_PORTS = ['10143', '10025']
def check_credentials(user, password, ip, protocol=None, auth_port=None, source_port=None):
if not user or not user.enabled or (protocol == "imap" and not user.enable_imap and not auth_port in WEBMAIL_PORTS) or (protocol == "pop3" and not user.enable_pop):
app.logger.info(f'Login attempt for: {user}/{protocol}/{auth_port} from: {ip}/{source_port}: failed: accound disabled')
app.logger.info(f'Login attempt for: {user}/{protocol}/{auth_port} from: {ip}/{source_port}: failed: account disabled')
return False
# webmails
if auth_port in WEBMAIL_PORTS and password.startswith('token-'):
@ -40,7 +40,7 @@ def check_credentials(user, password, ip, protocol=None, auth_port=None, source_
for token in user.tokens:
if (token.check_password(password) and
(not token.ip or token.ip == ip)):
app.logger.info(f'Login attempt for: {user}/{protocol}/{auth_port} from: {ip}/{source_port}: success: token-{token.id}: {token.comment or \'\'!r}')
app.logger.info(f'Login attempt for: {user}/{protocol}/{auth_port} from: {ip}/{source_port}: success: token-{token.id}: {token.comment or ""!r}')
return True
if user.check_password(password):
app.logger.info(f'Login attempt for: {user}/{protocol}/{auth_port} from: {ip}/{source_port}: success: password')