##// END OF EJS Templates
auth-ldap: improve messages when users failed to authenticate. Fixes #5345
marcink -
r1883:650a93a4 default
parent child Browse files
Show More
@@ -293,7 +293,8 b' class AuthLdap(object):'
293 log.warning(msg, username)
293 log.warning(msg, username)
294 raise LdapPasswordError(msg)
294 raise LdapPasswordError(msg)
295 if "," in username:
295 if "," in username:
296 raise LdapUsernameError("invalid character in username: ,")
296 raise LdapUsernameError(
297 "invalid character `,` in username: `{}`".format(username))
297 try:
298 try:
298 server = self._get_ldap_server()
299 server = self._get_ldap_server()
299 filter_ = '(&%s(%s=%s))' % (
300 filter_ = '(&%s(%s=%s))' % (
@@ -319,8 +320,9 b' class AuthLdap(object):'
319 break
320 break
320
321
321 else:
322 else:
322 raise LdapPasswordError('Failed to authenticate user '
323 raise LdapPasswordError(
323 'with given password')
324 'Failed to authenticate user `{}`'
325 'with given password'.format(username))
324
326
325 except ldap.NO_SUCH_OBJECT:
327 except ldap.NO_SUCH_OBJECT:
326 log.debug("LDAP says no such user '%s' (%s), org_exc:",
328 log.debug("LDAP says no such user '%s' (%s), org_exc:",
General Comments 0
You need to be logged in to leave comments. Login now