From 118f55d95c8778a151f0a6ccd1c8f020bc8eeda8 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 9 Apr 2021 11:24:07 +0200 Subject: [PATCH] sources/ldap: fix error during event creation Signed-off-by: Jens Langhammer --- authentik/sources/ldap/signals.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/authentik/sources/ldap/signals.py b/authentik/sources/ldap/signals.py index a20473035..1ec5d5f2a 100644 --- a/authentik/sources/ldap/signals.py +++ b/authentik/sources/ldap/signals.py @@ -4,7 +4,7 @@ from typing import Any from django.db.models.signals import post_save from django.dispatch import receiver from django.utils.translation import gettext_lazy as _ -from ldap3.core.exceptions import LDAPException +from ldap3.core.exceptions import LDAPOperationResult from rest_framework.serializers import ValidationError from authentik.core.models import User @@ -55,10 +55,10 @@ def ldap_sync_password(sender, user: User, password: str, **_): changer = LDAPPasswordChanger(source) try: changer.change_password(user, password) - except LDAPException as exc: + except LDAPOperationResult as exc: Event.new( EventAction.CONFIGURATION_ERROR, - message=str(exc), + message=f"Result: {exc.result}, Description {exc.description}", source=source, ).set_user(user).save() raise ValidationError("Failed to set password") from exc