diff --git a/src/main/java/de/scimeda/keycloak/events/logging/LastLoginEventListenerProvider.java b/src/main/java/de/scimeda/keycloak/events/logging/LastLoginEventListenerProvider.java index 81a23a6..1c6cb38 100644 --- a/src/main/java/de/scimeda/keycloak/events/logging/LastLoginEventListenerProvider.java +++ b/src/main/java/de/scimeda/keycloak/events/logging/LastLoginEventListenerProvider.java @@ -40,7 +40,9 @@ public class LastLoginEventListenerProvider implements EventListenerProvider { Map> userAttrs = user.getAttributes(); if (userAttrs.containsKey("last-login")) { String userLastLogin = userAttrs.get("last-login").get(0); - user.setSingleAttribute("prior-login", userLastLogin); + if (userLastLogin != null && !userLastLogin.isEmpty()) { + user.setSingleAttribute("prior-login", userLastLogin); + } } // Use current server time for login event