From: parmentelat Date: Fri, 14 Dec 2018 12:09:08 +0000 (+0100) Subject: add troubleshooting info in plcapi.log when passwd auth fails X-Git-Tag: plcapi-7.0-0~13 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=da5f40b50a37db4b4c8d63346724649813647e05;p=plcapi.git add troubleshooting info in plcapi.log when passwd auth fails --- diff --git a/PLC/Auth.py b/PLC/Auth.py index 33f60c24..c1684b59 100644 --- a/PLC/Auth.py +++ b/PLC/Auth.py @@ -23,7 +23,7 @@ from PLC.Sessions import Session, Sessions from PLC.Peers import Peer, Peers from PLC.Keys import Keys from PLC.Boot import notify_owners - +from PLC.Logger import logger class Auth(Parameter): """ @@ -299,9 +299,11 @@ class PasswordAuth(Auth): assert 'Username' in auth # Get record (must be enabled) + normalized = auth['Username'].lower() persons = Persons(method.api, { - 'email': auth['Username'].lower(), 'enabled': True, 'peer_id': None}) + 'email': normalized, 'enabled': True, 'peer_id': None}) if len(persons) != 1: + logger.info(f"PasswordAuth failed with {normalized}, got {len(persons)} matches") raise PLCAuthenticationFailure("PasswordAuth: No such account") person = persons[0]