# HG changeset patch # User Marcin Kuzminski # Date 2017-06-30 13:09:12 # Node ID 650a93a4dcce25b40eb9b651375565a8737607fb # Parent 66946a16550a5c4b456b728367e53bcd14107ec7 auth-ldap: improve messages when users failed to authenticate. Fixes #5345 diff --git a/rhodecode/authentication/plugins/auth_ldap.py b/rhodecode/authentication/plugins/auth_ldap.py --- a/rhodecode/authentication/plugins/auth_ldap.py +++ b/rhodecode/authentication/plugins/auth_ldap.py @@ -293,7 +293,8 @@ class AuthLdap(object): log.warning(msg, username) raise LdapPasswordError(msg) if "," in username: - raise LdapUsernameError("invalid character in username: ,") + raise LdapUsernameError( + "invalid character `,` in username: `{}`".format(username)) try: server = self._get_ldap_server() filter_ = '(&%s(%s=%s))' % ( @@ -319,8 +320,9 @@ class AuthLdap(object): break else: - raise LdapPasswordError('Failed to authenticate user ' - 'with given password') + raise LdapPasswordError( + 'Failed to authenticate user `{}`' + 'with given password'.format(username)) except ldap.NO_SUCH_OBJECT: log.debug("LDAP says no such user '%s' (%s), org_exc:",